void Update() { if (!onLadder && playerState != PlatformerStates.airborne) { playerState = PlatformerStates.grounded; } if (onLadder && Input.GetKey("w")) { playerState = PlatformerStates.climbing; Climb(); } if (onLadder && Input.GetKey("s")) { playerState = PlatformerStates.climbing; Descend(); } if (playerState == PlatformerStates.grounded && Input.GetKey("d")) { MoveRight(); } if (playerState == PlatformerStates.grounded && Input.GetKey("a")) { MoveLeft(); } if (playerState == PlatformerStates.grounded && Input.GetKeyDown("space")) { Jump(); } }
void Start() { playerState = PlatformerStates.grounded; }