mirror of
				https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
				synced 2025-06-27 11:58:51 +02:00 
			
		
		
		
	feat: manage rotation z on level json
This commit is contained in:
		| @@ -84,7 +84,8 @@ public class JSONExporter : MonoBehaviour | ||||
|                 x = Mathf.Round(pos.x * 100f) / 100f, | ||||
|                 y = Mathf.Round(pos.y * 100f) / 100f, | ||||
|                 scaleX = Mathf.Round(scale.x * 100f) / 100f, | ||||
|                 scaleY = Mathf.Round(scale.y * 100f) / 100f | ||||
|                 scaleY = Mathf.Round(scale.y * 100f) / 100f, | ||||
|                 rotationZ = Mathf.Round(go.transform.rotation.eulerAngles.z * 100f) / 100f | ||||
|             }); | ||||
|         } | ||||
|  | ||||
| @@ -139,7 +140,7 @@ public class JSONExporter : MonoBehaviour | ||||
|     private class SerializableElement | ||||
|     { | ||||
|         public string type; | ||||
|         public float x, y, scaleX, scaleY; | ||||
|         public float x, y, scaleX, scaleY, rotationZ; | ||||
|     } | ||||
|  | ||||
|     [System.Serializable] | ||||
|   | ||||
| @@ -11,6 +11,7 @@ public class LevelElement | ||||
|     public float y; | ||||
|     public float scaleX = -1; | ||||
|     public float scaleY = -1; | ||||
|     public float rotationZ = 0; | ||||
| } | ||||
|  | ||||
| [System.Serializable] | ||||
|   | ||||
| @@ -85,6 +85,12 @@ public class LevelLoader : MonoBehaviour | ||||
|             float newScaleX = element.scaleX > 0 ? element.scaleX : originalScale.x; | ||||
|             float newScaleY = element.scaleY > 0 ? element.scaleY : originalScale.y; | ||||
|             instance.transform.localScale = new Vector3(newScaleX, newScaleY, originalScale.z); | ||||
|  | ||||
|             // Appliquer la rotation | ||||
|             if (element.rotationZ != 0) | ||||
|             { | ||||
|                 instance.transform.rotation = Quaternion.Euler(0, 0, element.rotationZ); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         // Sol uniquement en mode jeu | ||||
|   | ||||
		Reference in New Issue
	
	Block a user