mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-09-07 09:55:24 -05:00
Everything is StateMachined just bugtesting
This commit is contained in:
@@ -4,19 +4,33 @@ using UnityEngine;
|
||||
|
||||
public class OffenseCooldownState : OffenseBaseState
|
||||
{
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
bool cooldown = false;
|
||||
|
||||
}
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
cooldown = false;
|
||||
|
||||
oSM.StartCoroutine(kickCooldown());
|
||||
}
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
if(cooldown && (oSM.mSM.currentState == oSM.mSM.RagdollState || oSM.mSM.currentState == oSM.mSM.SlideState || oSM.mSM.currentState == oSM.mSM.CrouchState || oSM.mSM.currentState == oSM.mSM.CrouchWalkState) || (oSM.aSM.currentState == oSM.aSM.WallRunState || oSM.aSM.currentState == oSM.aSM.WallIdleState || oSM.aSM.currentState == oSM.aSM.GrappleAirState || oSM.aSM.currentState == oSM.aSM.GrappleGroundedState)){
|
||||
oSM.SwitchState(oSM.IncapacitatedState);
|
||||
}
|
||||
else if(cooldown){
|
||||
oSM.SwitchState(oSM.NoneState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator kickCooldown(){
|
||||
yield return new WaitForSeconds(.5f);
|
||||
cooldown = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ public class OffenseIncapacitatedState : OffenseBaseState
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
if((oSM.mSM.currentState != oSM.mSM.RagdollState && oSM.mSM.currentState != oSM.mSM.SlideState && oSM.mSM.currentState != oSM.mSM.CrouchState && oSM.mSM.currentState != oSM.mSM.CrouchWalkState) && (oSM.aSM.currentState != oSM.aSM.WallRunState && oSM.aSM.currentState != oSM.aSM.WallIdleState && oSM.aSM.currentState != oSM.aSM.GrappleAirState && oSM.aSM.currentState != oSM.aSM.GrappleGroundedState)){
|
||||
oSM.SwitchState(oSM.NoneState);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
||||
@@ -14,6 +14,25 @@ public class OffenseNoneState : OffenseBaseState
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
if((oSM.mSM.currentState == oSM.mSM.RagdollState || oSM.mSM.currentState == oSM.mSM.SlideState || oSM.mSM.currentState == oSM.mSM.CrouchState || oSM.mSM.currentState == oSM.mSM.CrouchWalkState) || (oSM.aSM.currentState == oSM.aSM.WallRunState || oSM.aSM.currentState == oSM.aSM.WallIdleState || oSM.aSM.currentState == oSM.aSM.GrappleAirState || oSM.aSM.currentState == oSM.aSM.GrappleGroundedState)){
|
||||
oSM.SwitchState(oSM.IncapacitatedState);
|
||||
}
|
||||
else if(oSM.aSM.currentState == oSM.aSM.GroundedState && (Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0)){
|
||||
if(oSM.pStats.KickPow > 300){
|
||||
oSM.SwitchState(oSM.PunchState);
|
||||
}
|
||||
else{
|
||||
oSM.SwitchState(oSM.KickState);
|
||||
}
|
||||
}
|
||||
else if((Input.GetKeyDown(KeyCode.F) || Input.GetAxis("Kick") != 0)){
|
||||
if(oSM.pStats.KickPow > 300){
|
||||
oSM.SwitchState(oSM.AirPunchState);
|
||||
}
|
||||
else{
|
||||
oSM.SwitchState(oSM.AirKickState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
||||
Reference in New Issue
Block a user