//Run every frame we are in the idle state. private void Idle_SuperUpdate() { //If Jump. if (rpgCharacterInputController.allowedInput && rpgCharacterController.Jump()) { currentState = RPGCharacterState.Jump; rpgCharacterState = RPGCharacterState.Jump; return; } if (!MaintainingGround()) { currentState = RPGCharacterState.Fall; rpgCharacterState = RPGCharacterState.Fall; return; } if (rpgCharacterInputController.HasMoveInput() && canMove) { currentState = RPGCharacterState.Move; rpgCharacterState = RPGCharacterState.Move; return; } //Apply friction to slow to a halt. currentVelocity = Vector3.MoveTowards(currentVelocity, Vector3.zero, groundFriction * superCharacterController.deltaTime); }