Fixed AI C# Script for final submission #283

Merged
mushgunAX merged 8 commits from AIFinalFixesGAM300M3 into main 2022-11-25 22:33:58 +08:00
1 changed files with 2 additions and 2 deletions
Showing only changes of commit 609be908f9 - Show all commits

View File

@ -285,7 +285,7 @@ public class PlayerController : Script
{ {
if (currentState == RaccoonStates.WALKING || currentState == RaccoonStates.RUNNING || currentState == RaccoonStates.IDLE) if (currentState == RaccoonStates.WALKING || currentState == RaccoonStates.RUNNING || currentState == RaccoonStates.IDLE)
{ {
if (Input.GetKey(Input.KeyCode.Space) && isGrounded && rb != null) if (Input.GetKeyDown(Input.KeyCode.Space) && isGrounded && rb != null)
{ {
currentState = RaccoonStates.JUMP; currentState = RaccoonStates.JUMP;
Vector3 v = rb.LinearVelocity; Vector3 v = rb.LinearVelocity;
@ -304,7 +304,7 @@ public class PlayerController : Script
} }
} }
if(!isGrounded && rb != null && (rb.LinearVelocity.y < 0.0f || !Input.GetKey(Input.KeyCode.Space))) if(!isGrounded && rb != null && (rb.LinearVelocity.y < 0.0f || Input.GetKeyUp(Input.KeyCode.Space)))
currentState = RaccoonStates.FALLING; currentState = RaccoonStates.FALLING;
} }