mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-04-26 02:00:54 -05:00
Setup all the files so they can be state machined
This commit is contained in:
parent
833183d034
commit
f580be178a
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DashCooldownState : MonoBehaviour
|
||||
public class DashCooldownState : DashBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(DashStateManager dSM, DashBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(DashStateManager dSM, DashBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(DashStateManager dSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(DashStateManager dSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DashDashingState : MonoBehaviour
|
||||
public class DashDashingState : DashBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(DashStateManager dSM, DashBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(DashStateManager dSM, DashBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(DashStateManager dSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(DashStateManager dSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DashIncapacitatedState : MonoBehaviour
|
||||
public class DashIncapacitatedState : DashBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(DashStateManager dSM, DashBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(DashStateManager dSM, DashBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(DashStateManager dSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(DashStateManager dSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DashNoneState : MonoBehaviour
|
||||
public class DashNoneState : DashBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(DashStateManager dSM, DashBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(DashStateManager dSM, DashBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(DashStateManager dSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(DashStateManager dSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ public class DashStateManager : MonoBehaviour
|
|||
public DashNoneState NoneState = new DashNoneState();
|
||||
public DashIncapacitatedState IncapacitatedState = new DashIncapacitatedState();
|
||||
public DashCooldownState CooldownState = new DashCooldownState();
|
||||
public DashDashingState DashingState = new DashDashingState();
|
||||
////
|
||||
|
||||
////Objects Sections
|
||||
GameObject parentObj; // Parent object
|
||||
public Camera cam; // Camera object
|
||||
////
|
||||
|
||||
////Components Section
|
||||
|
|
@ -30,4 +30,50 @@ public class DashStateManager : MonoBehaviour
|
|||
public PlayerStats pStats; // Player Stats
|
||||
public MoveStateManager mSM;
|
||||
////
|
||||
|
||||
void Awake(){
|
||||
|
||||
////Initialize Player Components
|
||||
moveController = GetComponent<CharacterController>(); // set Character Controller
|
||||
rB = GetComponent<Rigidbody>(); //set Rigid Body
|
||||
capCol = GetComponent<CapsuleCollider>(); // set Capsule Collider
|
||||
capCol.enabled = true;
|
||||
parentObj = transform.parent.gameObject; // set parent object
|
||||
animator = GetComponent<Animator>(); // set animator
|
||||
////
|
||||
|
||||
////Initialize Scripts
|
||||
pStats = GetComponent<PlayerStats>(); // set PlayerStats
|
||||
mSM = GetComponent<MoveStateManager>(); // set move state manager
|
||||
////
|
||||
}
|
||||
|
||||
void Start(){
|
||||
//players starting state
|
||||
currentState = NoneState;
|
||||
previousState = NoneState;
|
||||
currentState.EnterState(this, previousState);
|
||||
}
|
||||
|
||||
void Update(){
|
||||
//calls any logic in the update state from current state
|
||||
currentState.UpdateState(this);
|
||||
}
|
||||
|
||||
void FixedUpdate(){
|
||||
//calls any logic in the fixed update state from current state
|
||||
currentState.FixedUpdateState(this);
|
||||
}
|
||||
|
||||
public void SwitchState(DashBaseState state){
|
||||
|
||||
currentState.ExitState(this, state);
|
||||
|
||||
//Sets the previous State
|
||||
previousState = currentState;
|
||||
|
||||
//updates current state and calls logic for entering
|
||||
currentState = state;
|
||||
currentState.EnterState(this, previousState);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class NitroCooldownState : MonoBehaviour
|
||||
public class NitroCooldownState : NitroBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(NitroStateManager nSM, NitroBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(NitroStateManager nSM, NitroBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(NitroStateManager nSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(NitroStateManager nSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class NitroIncapacitatedState : MonoBehaviour
|
||||
public class NitroIncapacitatedState : NitroBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(NitroStateManager nSM, NitroBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(NitroStateManager nSM, NitroBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(NitroStateManager nSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(NitroStateManager nSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class NitroNitroingState : MonoBehaviour
|
||||
public class NitroNitroingState : NitroBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(NitroStateManager nSM, NitroBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(NitroStateManager nSM, NitroBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(NitroStateManager nSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(NitroStateManager nSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class NitroNoneState : MonoBehaviour
|
||||
public class NitroNoneState : NitroBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(NitroStateManager nSM, NitroBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(NitroStateManager nSM, NitroBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(NitroStateManager nSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(NitroStateManager nSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,16 @@ public class NitroStateManager : MonoBehaviour
|
|||
////Player States
|
||||
public NitroBaseState currentState;
|
||||
public NitroBaseState previousState;
|
||||
|
||||
//Nitro States
|
||||
public NitroNoneState NoneState = new NitroNoneState();
|
||||
public NitroIncapacitatedState IncapacitatedState = new NitroIncapacitatedState();
|
||||
public NitroCooldownState CooldownState = new NitroCooldownState();
|
||||
public NitroNitroingState NitroingState = new NitroNitroingState();
|
||||
////
|
||||
|
||||
|
||||
////Objects Sections
|
||||
GameObject parentObj; // Parent object
|
||||
public Camera cam; // Camera object
|
||||
////
|
||||
|
||||
////Components Section
|
||||
|
|
@ -25,4 +30,50 @@ public class NitroStateManager : MonoBehaviour
|
|||
public PlayerStats pStats; // Player Stats
|
||||
public MoveStateManager mSM;
|
||||
////
|
||||
|
||||
void Awake(){
|
||||
|
||||
////Initialize Player Components
|
||||
moveController = GetComponent<CharacterController>(); // set Character Controller
|
||||
rB = GetComponent<Rigidbody>(); //set Rigid Body
|
||||
capCol = GetComponent<CapsuleCollider>(); // set Capsule Collider
|
||||
capCol.enabled = true;
|
||||
parentObj = transform.parent.gameObject; // set parent object
|
||||
animator = GetComponent<Animator>(); // set animator
|
||||
////
|
||||
|
||||
////Initialize Scripts
|
||||
pStats = GetComponent<PlayerStats>(); // set PlayerStats
|
||||
mSM = GetComponent<MoveStateManager>(); // set move state manager
|
||||
////
|
||||
}
|
||||
|
||||
void Start(){
|
||||
//players starting state
|
||||
currentState = NoneState;
|
||||
previousState = NoneState;
|
||||
currentState.EnterState(this, previousState);
|
||||
}
|
||||
|
||||
void Update(){
|
||||
//calls any logic in the update state from current state
|
||||
currentState.UpdateState(this);
|
||||
}
|
||||
|
||||
void FixedUpdate(){
|
||||
//calls any logic in the fixed update state from current state
|
||||
currentState.FixedUpdateState(this);
|
||||
}
|
||||
|
||||
public void SwitchState(NitroBaseState state){
|
||||
|
||||
currentState.ExitState(this, state);
|
||||
|
||||
//Sets the previous State
|
||||
previousState = currentState;
|
||||
|
||||
//updates current state and calls logic for entering
|
||||
currentState = state;
|
||||
currentState.EnterState(this, previousState);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class OffenseAirKickState : MonoBehaviour
|
||||
public class OffenseAirKickState : OffenseBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class OffenseAirPunchState : MonoBehaviour
|
||||
public class OffenseAirPunchState : OffenseBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class OffenseKickState : MonoBehaviour
|
||||
public class OffenseKickState : OffenseBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class OffensePunchState : MonoBehaviour
|
||||
public class OffensePunchState : OffenseBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class OffenseCooldownState : MonoBehaviour
|
||||
public class OffenseCooldownState : OffenseBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class OffenseIncapacitatedState : MonoBehaviour
|
||||
public class OffenseIncapacitatedState : OffenseBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,21 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class OffenseNoneState : MonoBehaviour
|
||||
public class OffenseNoneState : OffenseBaseState
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
public override void EnterState(OffenseStateManager oSM, OffenseBaseState previousState){
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
|
||||
public override void FixedUpdateState(OffenseStateManager oSM){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,21 @@ public class OffenseStateManager : MonoBehaviour
|
|||
////Player States
|
||||
public OffenseBaseState currentState;
|
||||
public OffenseBaseState previousState;
|
||||
|
||||
//Offense States
|
||||
public OffenseNoneState NoneState = new OffenseNoneState();
|
||||
public OffenseIncapacitatedState IncapacitatedState = new OffenseIncapacitatedState();
|
||||
public OffenseCooldownState CooldownState = new OffenseCooldownState();
|
||||
|
||||
//Kick&Punch States
|
||||
public OffenseKickState KickState = new OffenseKickState();
|
||||
public OffenseAirKickState AirKickState = new OffenseAirKickState();
|
||||
public OffensePunchState PunchState = new OffensePunchState();
|
||||
public OffenseAirPunchState AirPunchState = new OffenseAirPunchState();
|
||||
////
|
||||
|
||||
////Objects Sections
|
||||
GameObject parentObj; // Parent object
|
||||
public Camera cam; // Camera object
|
||||
////
|
||||
|
||||
////Components Section
|
||||
|
|
@ -25,4 +35,50 @@ public class OffenseStateManager : MonoBehaviour
|
|||
public PlayerStats pStats; // Player Stats
|
||||
public MoveStateManager mSM;
|
||||
////
|
||||
|
||||
void Awake(){
|
||||
|
||||
////Initialize Player Components
|
||||
moveController = GetComponent<CharacterController>(); // set Character Controller
|
||||
rB = GetComponent<Rigidbody>(); //set Rigid Body
|
||||
capCol = GetComponent<CapsuleCollider>(); // set Capsule Collider
|
||||
capCol.enabled = true;
|
||||
parentObj = transform.parent.gameObject; // set parent object
|
||||
animator = GetComponent<Animator>(); // set animator
|
||||
////
|
||||
|
||||
////Initialize Scripts
|
||||
pStats = GetComponent<PlayerStats>(); // set PlayerStats
|
||||
mSM = GetComponent<MoveStateManager>(); // set move state manager
|
||||
////
|
||||
}
|
||||
|
||||
void Start(){
|
||||
//players starting state
|
||||
currentState = NoneState;
|
||||
previousState = NoneState;
|
||||
currentState.EnterState(this, previousState);
|
||||
}
|
||||
|
||||
void Update(){
|
||||
//calls any logic in the update state from current state
|
||||
currentState.UpdateState(this);
|
||||
}
|
||||
|
||||
void FixedUpdate(){
|
||||
//calls any logic in the fixed update state from current state
|
||||
currentState.FixedUpdateState(this);
|
||||
}
|
||||
|
||||
public void SwitchState(OffenseBaseState state){
|
||||
|
||||
currentState.ExitState(this, state);
|
||||
|
||||
//Sets the previous State
|
||||
previousState = currentState;
|
||||
|
||||
//updates current state and calls logic for entering
|
||||
currentState = state;
|
||||
currentState.EnterState(this, previousState);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user