mirror of
https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
synced 2025-05-21 23:48:26 +02:00
feat: manage rotation z on level json
This commit is contained in:
parent
dc442e2acb
commit
ca831d77f0
@ -84,7 +84,8 @@ public class JSONExporter : MonoBehaviour
|
|||||||
x = Mathf.Round(pos.x * 100f) / 100f,
|
x = Mathf.Round(pos.x * 100f) / 100f,
|
||||||
y = Mathf.Round(pos.y * 100f) / 100f,
|
y = Mathf.Round(pos.y * 100f) / 100f,
|
||||||
scaleX = Mathf.Round(scale.x * 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
|
private class SerializableElement
|
||||||
{
|
{
|
||||||
public string type;
|
public string type;
|
||||||
public float x, y, scaleX, scaleY;
|
public float x, y, scaleX, scaleY, rotationZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
|
@ -11,6 +11,7 @@ public class LevelElement
|
|||||||
public float y;
|
public float y;
|
||||||
public float scaleX = -1;
|
public float scaleX = -1;
|
||||||
public float scaleY = -1;
|
public float scaleY = -1;
|
||||||
|
public float rotationZ = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
|
@ -85,6 +85,12 @@ public class LevelLoader : MonoBehaviour
|
|||||||
float newScaleX = element.scaleX > 0 ? element.scaleX : originalScale.x;
|
float newScaleX = element.scaleX > 0 ? element.scaleX : originalScale.x;
|
||||||
float newScaleY = element.scaleY > 0 ? element.scaleY : originalScale.y;
|
float newScaleY = element.scaleY > 0 ? element.scaleY : originalScale.y;
|
||||||
instance.transform.localScale = new Vector3(newScaleX, newScaleY, originalScale.z);
|
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
|
// Sol uniquement en mode jeu
|
||||||
|
Loading…
x
Reference in New Issue
Block a user