mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-03-23 02:04:17 -05:00
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class DashCooldownState : DashBaseState
|
|
{
|
|
private CoolDown driver;
|
|
bool cooldown = false;
|
|
|
|
public override void EnterState(DashStateManager dSM, DashBaseState previousState){
|
|
cooldown = false;
|
|
dSM.StartCoroutine(startCoolDown(dSM));
|
|
}
|
|
|
|
public override void ExitState(DashStateManager dSM, DashBaseState nextState){
|
|
|
|
}
|
|
|
|
public override void UpdateState(DashStateManager dSM){
|
|
if(cooldown && (dSM.mSM.currentState == dSM.mSM.RagdollState || dSM.mSM.currentState == dSM.mSM.RecoveringState || dSM.mSM.currentState == dSM.mSM.SlideState || dSM.mSM.currentState == dSM.mSM.CrouchState || dSM.mSM.currentState == dSM.mSM.CrouchWalkState)){
|
|
dSM.SwitchState(dSM.IncapacitatedState);
|
|
}
|
|
else if(cooldown){
|
|
dSM.SwitchState(dSM.NoneState);
|
|
}
|
|
}
|
|
|
|
public override void FixedUpdateState(DashStateManager dSM){
|
|
|
|
}
|
|
|
|
private IEnumerator startCoolDown(DashStateManager dSM){
|
|
//driver.startUICooldown(dashItem.name);
|
|
yield return new WaitForSeconds(dSM.dashItem.cooldownM);
|
|
cooldown = true;
|
|
}
|
|
}
|