public void Execute(Player player) { // To Transition out you can raycast - Make the cast distance really small (.55 past center position so .05f from ground if (Physics.Raycast(player.transform.position, Vector3.down, 1.3f)) { Standing stand = new Standing(); stand.Enter(player); } }
public void Execute(Player player) { // Debug.Log("Ducking"); // Put all key checks into State functions - this gets run every frame the state is active - no need for switch if (Input.GetKeyUp(KeyCode.S)) { // Transition to standing - no need to toggle Standing standing = new Standing(); standing.Enter(player); } }
public void Execute(Player player) { // To Transition out you can raycast - Make the cast distance really small (.55 past center position so .05f from ground if (Physics.Raycast(player.transform.position, Vector3.down, 1f)) { Debug.Log("Hit Ground"); Standing stand = new Standing(); stand.Enter(player); } if (Input.GetKeyDown(KeyCode.S)) { Diving dive = new Diving(); dive.Enter(player); } }
public void Execute(Player player) { // To Transition out you can raycast - Make the cast distance really small (.55 past center position so .05f from ground if (Input.GetKeyUp(KeyCode.S)) { if (Input.GetKey(KeyCode.W)) { Sprinting sprint = new Sprinting(); sprint.Enter(player); } else { Standing standing = new Standing(); standing.Enter(player); } } }
public void Execute(Player player) { // To Transition out you can raycast - Make the cast distance really small (.55 past center position so .05f from ground if (Physics.Raycast(player.transform.position, Vector3.down, 1f)) { if (Input.GetKey(KeyCode.W)) { Debug.Log("Hit Ground"); Sprinting sprint = new Sprinting(); sprint.Enter(player); } else { Debug.Log("Hit Ground"); Standing standing = new Standing(); standing.Enter(player); } } }
public void Execute(Player player) { Rigidbody rb = player.GetComponent <Rigidbody>(); rb.velocity = new Vector3(player.speed, 0, 0); // Put all key checks into State functions - this gets run every frame the state is active - no need for switch if (Input.GetKeyUp(KeyCode.W)) { Standing standing = new Standing(); standing.Enter(player); } if (Input.GetKeyDown(KeyCode.Space)) { LongJump lJump = new LongJump(); lJump.Enter(player); } if (Input.GetKeyDown(KeyCode.S)) { Sliding slide = new Sliding(); slide.Enter(player); } }