mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 09:54:28 -05:00
Fine tuned animations
This commit is contained in:
@@ -5,11 +5,11 @@ using UnityEngine;
|
||||
public class dAerialFallingState : dAerialBaseState
|
||||
{
|
||||
public override void EnterState(dAerialStateManager aSM, dAerialBaseState previousState){
|
||||
|
||||
aSM.GetComponent<Animator>().SetBool("isFalling", true);
|
||||
}
|
||||
|
||||
public override void ExitState(dAerialStateManager aSM, dAerialBaseState nextState){
|
||||
|
||||
aSM.GetComponent<Animator>().SetBool("isFalling", false);
|
||||
}
|
||||
|
||||
public override void UpdateState(dAerialStateManager aSM){
|
||||
|
||||
@@ -5,12 +5,24 @@ using UnityEngine;
|
||||
public class dAerialJumpingState : dAerialBaseState
|
||||
{
|
||||
|
||||
private int previousJumpNum;
|
||||
public override void EnterState(dAerialStateManager aSM, dAerialBaseState previousState){
|
||||
|
||||
previousJumpNum = aSM.curJumpNum;
|
||||
if (aSM.curJumpNum % 2 == 1)
|
||||
{
|
||||
aSM.GetComponent<Animator>().SetBool("isJumpingLeft", true);
|
||||
}
|
||||
//if even, do right jump
|
||||
else if (aSM.curJumpNum % 2 == 0)
|
||||
{
|
||||
aSM.GetComponent<Animator>().SetBool("isJumpingRight", true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExitState(dAerialStateManager aSM, dAerialBaseState nextState){
|
||||
|
||||
|
||||
aSM.GetComponent<Animator>().SetBool("isJumpingLeft", false);
|
||||
aSM.GetComponent<Animator>().SetBool("isJumpingRight", false);
|
||||
}
|
||||
|
||||
public override void UpdateState(dAerialStateManager aSM){
|
||||
@@ -45,5 +57,22 @@ public class dAerialJumpingState : dAerialBaseState
|
||||
if(aSM.pStats.HasGrapple){
|
||||
aSM.GrappleReleaseForce();
|
||||
}
|
||||
|
||||
if(aSM.curJumpNum != previousJumpNum)
|
||||
{
|
||||
previousJumpNum = aSM.curJumpNum;
|
||||
aSM.GetComponent<Animator>().SetBool("isJumpingLeft", false);
|
||||
aSM.GetComponent<Animator>().SetBool("isJumpingRight", false);
|
||||
|
||||
if (aSM.curJumpNum % 2 == 1)
|
||||
{
|
||||
aSM.GetComponent<Animator>().SetBool("isJumpingLeft", true);
|
||||
}
|
||||
//if even, do right jump
|
||||
else if (aSM.curJumpNum % 2 == 0)
|
||||
{
|
||||
aSM.GetComponent<Animator>().SetBool("isJumpingRight", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,22 @@ public class dAerialWallRunState : dAerialBaseState
|
||||
aSM.pStats.GravVel = 0; // on entering reset grav vel
|
||||
spaceHeld = true; // prevent accidental wall jumping
|
||||
|
||||
//if left
|
||||
if(aSM.CalculateSide() < 0)
|
||||
{
|
||||
aSM.GetComponent<Animator>().SetBool("isLEFTWallRunning", true);
|
||||
}
|
||||
//if right
|
||||
else if (aSM.CalculateSide() > 0)
|
||||
{
|
||||
aSM.GetComponent<Animator>().SetBool("isRIGHTWallRunning", true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void ExitState(dAerialStateManager aSM, dAerialBaseState nextState){
|
||||
|
||||
aSM.GetComponent<Animator>().SetBool("isLEFTWallRunning", false);
|
||||
aSM.GetComponent<Animator>().SetBool("isRIGHTWallRunning", false);
|
||||
}
|
||||
|
||||
public override void UpdateState(dAerialStateManager aSM){
|
||||
|
||||
@@ -43,6 +43,7 @@ public class dAerialStateManager : NetworkBehaviour
|
||||
////Scripts Section
|
||||
public PlayerStats pStats; // Player Stats
|
||||
public dMoveStateManager mSM;
|
||||
private dAnimationManager animationManager;
|
||||
////
|
||||
|
||||
////Variables Section
|
||||
@@ -117,6 +118,7 @@ public class dAerialStateManager : NetworkBehaviour
|
||||
rB = GetComponent<Rigidbody>(); //set Rigid Body
|
||||
parentObj = transform.parent.gameObject; // set parent object
|
||||
animator = GetComponent<Animator>(); // set animator
|
||||
animationManager = GetComponent<dAnimationManager>();
|
||||
////
|
||||
|
||||
////Initialize Scripts
|
||||
@@ -203,6 +205,7 @@ public class dAerialStateManager : NetworkBehaviour
|
||||
|
||||
//updates current state and calls logic for entering
|
||||
currentState = state;
|
||||
animationManager.updateCurrentPriority();
|
||||
currentState.EnterState(this, previousState);
|
||||
}
|
||||
|
||||
@@ -493,7 +496,7 @@ public class dAerialStateManager : NetworkBehaviour
|
||||
}
|
||||
|
||||
//Calculate wall direction
|
||||
float CalculateSide(){
|
||||
public float CalculateSide(){
|
||||
if(isWallRunning)
|
||||
{
|
||||
Vector3 heading = lastWallPosition - transform.position;
|
||||
|
||||
@@ -17,6 +17,7 @@ public class dMoveCrouchState : dMoveBaseState
|
||||
mSM.moveController.center = new Vector3(0,mSM.moveController.center.y - mSM.moveController.height * .5f,0);
|
||||
//mSM.moveController.Move(new Vector3(0,-mSM.moveController.height * .5f,0));
|
||||
}
|
||||
mSM.animator.SetBool("isCrouching", true);
|
||||
}
|
||||
|
||||
public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){
|
||||
@@ -28,7 +29,8 @@ public class dMoveCrouchState : dMoveBaseState
|
||||
mSM.moveController.height *= 2.0f;
|
||||
mSM.moveController.center = new Vector3(0,mSM.moveController.center.y + mSM.moveController.height * .25f,0);
|
||||
}
|
||||
|
||||
mSM.animator.SetBool("isCrouching", false);
|
||||
|
||||
}
|
||||
|
||||
public override void UpdateState(dMoveStateManager mSM){
|
||||
|
||||
@@ -5,7 +5,7 @@ using UnityEngine;
|
||||
public class dMoveCrouchWalkState : dMoveBaseState
|
||||
{
|
||||
public override void EnterState(dMoveStateManager mSM, dMoveBaseState previousState){
|
||||
|
||||
mSM.animator.SetBool("isCrouchWalking", true);
|
||||
}
|
||||
|
||||
public override void ExitState(dMoveStateManager mSM, dMoveBaseState nextState){
|
||||
@@ -16,6 +16,7 @@ public class dMoveCrouchWalkState : dMoveBaseState
|
||||
mSM.moveController.height *= 2.0f;
|
||||
mSM.moveController.center = new Vector3(0,mSM.moveController.center.y + mSM.moveController.height * .25f,0);
|
||||
}
|
||||
mSM.animator.SetBool("isCrouchWalking", false);
|
||||
}
|
||||
|
||||
public override void UpdateState(dMoveStateManager mSM){
|
||||
|
||||
@@ -17,12 +17,14 @@ public class dOffenseAirKickState : dOffenseBaseState
|
||||
|
||||
//start kicking routine
|
||||
oSM.StartCoroutine(kicking(8f));
|
||||
oSM.GetComponent<Animator>().SetBool("isAerialKick", true);
|
||||
}
|
||||
|
||||
public override void ExitState(dOffenseStateManager oSM, dOffenseBaseState nextState){
|
||||
legRotation = 0; // reset leg angle
|
||||
oSM.leg.transform.eulerAngles = new Vector3(legRotation, oSM.leg.transform.eulerAngles.y, oSM.leg.transform.eulerAngles.z); // rotate leg
|
||||
oSM.leg.SetActive(false); // reset leg angle
|
||||
oSM.GetComponent<Animator>().SetBool("isAerialKick", false);
|
||||
}
|
||||
|
||||
public override void UpdateState(dOffenseStateManager oSM){
|
||||
|
||||
@@ -16,7 +16,7 @@ public class dOffenseKickState : dOffenseBaseState
|
||||
|
||||
oSM.animator.SetBool("IsKickingIdle", true);
|
||||
//start kicking routine
|
||||
oSM.StartCoroutine(kicking(1f));
|
||||
oSM.StartCoroutine(kicking(.833f));
|
||||
}
|
||||
|
||||
public override void ExitState(dOffenseStateManager oSM, dOffenseBaseState nextState){
|
||||
|
||||
Reference in New Issue
Block a user