//Basically controls the boolean that see if you've jumped in the last split second //Generally used to give the player absolute control in this short window public IEnumerator JumpControlCoolDown(float cooldownTimeSeconds, RecentActionType entryAction) { yield return new WaitForSeconds(cooldownTimeSeconds); if(recentAction == entryAction) { //check playerstate recentAction = RecentActionType.None; CmdSetRecentAction(RecentActionType.None); } isResetCRRunning = false; }
public IEnumerator JumpControlCooldownClampSpeed(float cooldownTimeSeconds, float maxSpeed, RecentActionType entryAction) { yield return new WaitForSeconds(cooldownTimeSeconds); if(recentAction == entryAction) { //check if something else changed the player state rb.velocity = Vector3.ClampMagnitude(new Vector3(rb.velocity.x, 0, rb.velocity.z), maxSpeed); recentAction = RecentActionType.None; CmdSetRecentAction(RecentActionType.None); } isResetCRRunning = false; }
// Start is called before the first frame update void Awake() { isGrounded = false; health = GetComponent<PlayerHealth>(); rb = GetComponent<Rigidbody>(); defaultPlayerController = GetComponent<DefaultPlayerController>(); wallPlayerController = GetComponent<WallPlayerController>(); grindPlayerController = GetComponent<GrindPlayerController>(); input = GetComponent<InputController>(); cc = GetComponent<CapsuleCollider>(); recentAction = RecentActionType.None; currentJumps = 0; currentDashes = 0; isResetCRRunning = false; angleOfNearestWall = 0f; }
public void CmdSetRecentAction(RecentActionType action) { recentAction = action; }