diff --git a/Assets/Prefabs/P_Explosion.prefab b/Assets/Prefabs/P_Explosion.prefab index d861656..fb2fc0b 100644 --- a/Assets/Prefabs/P_Explosion.prefab +++ b/Assets/Prefabs/P_Explosion.prefab @@ -36,7 +36,7 @@ ParticleSystem: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 120238} serializedVersion: 2 - lengthInSec: 3 + lengthInSec: 0.75 startDelay: scalar: 0 maxCurve: @@ -83,7 +83,7 @@ ParticleSystem: serializedVersion: 2 enabled: 1 startLifetime: - scalar: 3 + scalar: 0.75 maxCurve: serializedVersion: 2 m_Curve: @@ -237,7 +237,7 @@ ParticleSystem: rgba: 4294967295 minMaxState: 0 startSize: - scalar: 1 + scalar: 0.5 maxCurve: serializedVersion: 2 m_Curve: @@ -359,7 +359,7 @@ ParticleSystem: length: 5 boxX: 1 boxY: 1 - boxZ: 35.55 + boxZ: 1 arc: 360 placementMode: 0 m_Mesh: {fileID: 0} diff --git a/Assets/Scripts/Astronaut.cs b/Assets/Scripts/Astronaut.cs index 89de1c7..0eb37b1 100644 --- a/Assets/Scripts/Astronaut.cs +++ b/Assets/Scripts/Astronaut.cs @@ -61,13 +61,23 @@ public class Astronaut : MonoBehaviour { private float theta = 0; private float height = 0; - private float vSpeed = 0; + public float vSpeed = 0; private bool grounded = false; private float walkTime = 0; private int nextStep = 1; - // Use this for initialization + public float GetTheta() + { + return theta; + } + + public bool IsGrounded() + { + return grounded; + } + + // Use this for initialization void Start() { _astronautAnimator = GetComponent(); @@ -142,9 +152,10 @@ public class Astronaut : MonoBehaviour { if (State == AstronautState.Jumping) State = AstronautState.Idle; - vSpeed = 0f; + if (State < AstronautState.Ejecting) vSpeed = 0f; } + UpdatePosition(); //float x, y; @@ -224,6 +235,7 @@ public class Astronaut : MonoBehaviour { //TODO arreter mouvement lateral State=AstronautState.Idle; } + } public void Jump() diff --git a/Assets/Scripts/PlanetManager.cs b/Assets/Scripts/PlanetManager.cs index 4d560f8..607a232 100644 --- a/Assets/Scripts/PlanetManager.cs +++ b/Assets/Scripts/PlanetManager.cs @@ -33,6 +33,7 @@ public class PlanetManager : MonoBehaviour var obj = Instantiate(WedgePrefab, new Vector3(0.0f,0.0f, 0.0f), Quaternion.Euler(0, 0, debutAngleTheta)); obj.name = "wedge_" + i; w.sprite = GameObject.Find(obj.name); + w.gameObject = (GameObject)obj; wedges.Add(w); //pushes at end. } } @@ -99,9 +100,25 @@ public class PlanetManager : MonoBehaviour var v = wedges[indexOppose]; v.offset = v.offset + CartierStepSize; - if (v.offset > CartierMaxRatio) + if (v.offset >= CartierMaxRatio) + { v.offset = CartierMaxRatio; + + //checker si on éjecte des players + var players = FindObjectsOfType(); + foreach (var p in players) + { + if (v.tMax >= p.GetTheta() && p.GetTheta() >= v.tMin && p.IsGrounded()) + { + p.Eject(); + } + } + + + } + + v.sprite.transform.localScale = new Vector3(v.offset, v.offset, 1); // call fill gauge after every hit. @@ -233,6 +250,6 @@ public class PlanetManager : MonoBehaviour public float tMax = 0; public GameObject sprite; //sprite et collider 2D - + public GameObject gameObject; //wedge prefab avec collider } } diff --git a/Assets/_Scenes/Main.unity b/Assets/_Scenes/Main.unity index e7fa360..296f6ee 100644 --- a/Assets/_Scenes/Main.unity +++ b/Assets/_Scenes/Main.unity @@ -104,48 +104,6 @@ MonoBehaviour: WalkAnimSpeed: 0 WalkAnimAngle: 0 EjectSpinSpeed: 0 ---- !u!1001 &595727044 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2} - propertyPath: m_LocalPosition.x - value: 8.22 - objectReference: {fileID: 0} - - target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2} - propertyPath: m_LocalPosition.y - value: 1.36 - objectReference: {fileID: 0} - - target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2} - propertyPath: m_RootOrder - value: 6 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2} - m_IsPrefabParent: 0 --- !u!114 &1027139440 stripped MonoBehaviour: m_PrefabParentObject: {fileID: 11471614, guid: 198e988adacced646a19f757f6237ae1, @@ -367,6 +325,10 @@ Prefab: propertyPath: SpriteWalk value: objectReference: {fileID: 1106066633} + - target: {fileID: 11494368, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2} + propertyPath: EjectSpeed + value: 50 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2} m_IsPrefabParent: 0