diff --git a/Assets/Scripts/Astronaut.cs b/Assets/Scripts/Astronaut.cs index 12cd512..e78687b 100644 --- a/Assets/Scripts/Astronaut.cs +++ b/Assets/Scripts/Astronaut.cs @@ -18,6 +18,8 @@ public class Astronaut : MonoBehaviour { public float JumpSpeed; public float Gravity; public float Speed; + public float EjectSpeed; + public float DashSpeed; public PlanetManager planet; @@ -106,15 +108,27 @@ public class Astronaut : MonoBehaviour { if (!grounded) { height += vSpeed * delta; - vSpeed -= Gravity * delta; + if (State != AstronautState.Ejecting) + vSpeed -= Gravity * delta; + else + vSpeed *= 0.98f; } float radius = GetGroundRadius(); if (grounded = (height <= radius)) { + if (State == AstronautState.Dashing) + { + planet.PushWedge(Repeat(theta,360)); + State = AstronautState.Idle; + //TODO_SR Create dash impact here + } + height = radius; if (State == AstronautState.Jumping) State = AstronautState.Idle; + + vSpeed = 0f; } UpdatePosition(); @@ -208,12 +222,25 @@ public class Astronaut : MonoBehaviour { { if (_state >= AstronautState.Ejecting) return; + + State = AstronautState.Dashing; + vSpeed = -DashSpeed; + } + + public void Eject() + { + State = AstronautState.Ejecting; + vSpeed = EjectSpeed; + grounded = false; } public void OnGUI() { if (GUI.Button(new Rect(10, 10, 150, 50), State.ToString())) + { Debug.Log("Clicked the button with an image"); + Eject(); + } } /*IEnumerator WalkingStance() diff --git a/Assets/Test/SR_Player2.unity b/Assets/Test/SR_Player2.unity index 2007a20..cf24f80 100644 --- a/Assets/Test/SR_Player2.unity +++ b/Assets/Test/SR_Player2.unity @@ -572,6 +572,14 @@ Prefab: propertyPath: Width value: 0.4 objectReference: {fileID: 0} + - target: {fileID: 11494368, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2} + propertyPath: EjectSpeed + value: 15 + objectReference: {fileID: 0} + - target: {fileID: 11494368, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2} + propertyPath: DashSpeed + value: 12 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2} m_IsPrefabParent: 0