mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 01:44:30 -05:00
Merge branch 'animationController' into main
This commit is contained in:
@@ -5,11 +5,13 @@ using UnityEngine;
|
||||
public class dMoveIdleState : dMoveBaseState
|
||||
{
|
||||
public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){
|
||||
|
||||
mSM.GetComponent<Animator>().SetBool("isIdle", true);
|
||||
Debug.Log("Entered Idle");
|
||||
}
|
||||
|
||||
public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){
|
||||
|
||||
mSM.GetComponent<Animator>().SetBool("isIdle", false);
|
||||
Debug.Log("Exited Idle");
|
||||
}
|
||||
|
||||
public override void UpdateState(dMoveStateManager mSM){
|
||||
|
||||
@@ -5,11 +5,13 @@ using UnityEngine;
|
||||
public class dMoveJogState : dMoveBaseState
|
||||
{
|
||||
public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){
|
||||
|
||||
mSM.GetComponent<Animator>().SetBool("isJogging", true);
|
||||
Debug.Log("Entered Jog");
|
||||
}
|
||||
|
||||
public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){
|
||||
|
||||
mSM.GetComponent<Animator>().SetBool("isJogging", false);
|
||||
Debug.Log("Exited Jog");
|
||||
}
|
||||
|
||||
public override void UpdateState(dMoveStateManager mSM){
|
||||
|
||||
@@ -5,11 +5,13 @@ using UnityEngine;
|
||||
public class dMoveRunState : dMoveBaseState
|
||||
{
|
||||
public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){
|
||||
|
||||
mSM.GetComponent<Animator>().SetBool("isRunning", true);
|
||||
Debug.Log("Entered Run");
|
||||
}
|
||||
|
||||
public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){
|
||||
|
||||
mSM.GetComponent<Animator>().SetBool("isRunning", false);
|
||||
Debug.Log("Exit Run");
|
||||
}
|
||||
|
||||
public override void UpdateState(dMoveStateManager mSM){
|
||||
|
||||
@@ -4,12 +4,17 @@ using UnityEngine;
|
||||
|
||||
public class dMoveWalkState : dMoveBaseState
|
||||
{
|
||||
public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){
|
||||
|
||||
//set reference to animator in mSM for each manager
|
||||
public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){
|
||||
//get component is semi expensive--may want to ahve all statemanagers have a reference to animator
|
||||
mSM.GetComponent<Animator>().SetBool("isWalking", true);
|
||||
Debug.Log("Entered Walk");
|
||||
}
|
||||
|
||||
public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){
|
||||
|
||||
mSM.GetComponent<Animator>().SetBool("isWalking", false);
|
||||
Debug.Log("Exited Walk");
|
||||
}
|
||||
|
||||
public override void UpdateState(dMoveStateManager mSM){
|
||||
|
||||
@@ -37,12 +37,14 @@ public class dMoveStateManager : NetworkBehaviour
|
||||
public CharacterController moveController; // Character Controller
|
||||
public Rigidbody rB; // Players Rigidbody
|
||||
public CapsuleCollider capCol; // Players Capsule Collider
|
||||
private Animator animator; // Animation Controller
|
||||
public Animator animator; // Animation Controller
|
||||
////
|
||||
|
||||
////Scripts Section
|
||||
public PlayerStats pStats; // Player Stats
|
||||
public dAerialStateManager aSM;
|
||||
//// AnimatorManagerScript
|
||||
private AnimationManager animationManager;
|
||||
////
|
||||
|
||||
////State Transition Variables
|
||||
@@ -88,6 +90,7 @@ public class dMoveStateManager : NetworkBehaviour
|
||||
capCol.enabled = true;
|
||||
parentObj = transform.parent.gameObject; // set parent object
|
||||
animator = GetComponent<Animator>(); // set animator
|
||||
animationManager = GetComponent<AnimationManager>();
|
||||
////
|
||||
|
||||
////Initialize Scripts
|
||||
@@ -165,6 +168,8 @@ public class dMoveStateManager : NetworkBehaviour
|
||||
|
||||
//updates current state and calls logic for entering
|
||||
currentState = state;
|
||||
//update current animation priorty in animation manager
|
||||
animationManager.updateCurrentPriority();
|
||||
currentState.EnterState(this, previousState);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user