mirror of
https://github.com/Leahnaya/TheKingsRace.git
synced 2026-08-21 18:04:27 -05:00
Fine tuned animations
This commit is contained in:
@@ -5,12 +5,24 @@ using UnityEngine;
|
||||
public class AerialJumpingState : AerialBaseState
|
||||
{
|
||||
|
||||
private int previousJumpNum;
|
||||
public override void EnterState(AerialStateManager aSM, AerialBaseState previousState){
|
||||
|
||||
//if odd, do left jump
|
||||
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(AerialStateManager aSM, AerialBaseState nextState){
|
||||
|
||||
aSM.GetComponent<Animator>().SetBool("isJumpingLeft", false);
|
||||
aSM.GetComponent<Animator>().SetBool("isJumpingRight", false);
|
||||
}
|
||||
|
||||
public override void UpdateState(AerialStateManager aSM){
|
||||
@@ -44,6 +56,23 @@ public class AerialJumpingState : AerialBaseState
|
||||
//if grapple release then apply grapple release force
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +123,7 @@ public class AerialStateManager : NetworkBehaviour
|
||||
rB = GetComponent<Rigidbody>(); //set Rigid Body
|
||||
parentObj = transform.parent.gameObject; // set parent object
|
||||
animator = GetComponent<Animator>(); // set animator
|
||||
animationManager = GetComponent<AnimationManager>();
|
||||
////
|
||||
|
||||
////Initialize Scripts
|
||||
@@ -514,7 +515,7 @@ public class AerialStateManager : NetworkBehaviour
|
||||
}
|
||||
|
||||
//Calculate wall direction
|
||||
float CalculateSide(){
|
||||
public float CalculateSide(){
|
||||
if(isWallRunning)
|
||||
{
|
||||
Vector3 heading = lastWallPosition - transform.position;
|
||||
|
||||
@@ -10,11 +10,22 @@ public class AerialWallRunState : AerialBaseState
|
||||
|
||||
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(AerialStateManager aSM, AerialBaseState nextState){
|
||||
|
||||
aSM.GetComponent<Animator>().SetBool("isLEFTWallRunning", false);
|
||||
aSM.GetComponent<Animator>().SetBool("isRIGHTWallRunning", false);
|
||||
}
|
||||
|
||||
public override void UpdateState(AerialStateManager aSM){
|
||||
|
||||
@@ -17,6 +17,7 @@ public class MoveCrouchState : MoveBaseState
|
||||
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(MoveStateManager mSM, MoveBaseState nextState){
|
||||
@@ -28,7 +29,7 @@ public class MoveCrouchState : MoveBaseState
|
||||
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(MoveStateManager mSM){
|
||||
|
||||
@@ -5,7 +5,7 @@ using UnityEngine;
|
||||
public class MoveCrouchWalkState : MoveBaseState
|
||||
{
|
||||
public override void EnterState(MoveStateManager mSM, MoveBaseState previousState){
|
||||
|
||||
mSM.animator.SetBool("isCrouchWalking", true);
|
||||
}
|
||||
|
||||
public override void ExitState(MoveStateManager mSM, MoveBaseState nextState){
|
||||
@@ -16,6 +16,7 @@ public class MoveCrouchWalkState : MoveBaseState
|
||||
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(MoveStateManager mSM){
|
||||
|
||||
@@ -17,12 +17,14 @@ public class OffenseAirKickState : OffenseBaseState
|
||||
|
||||
//start kicking routine
|
||||
oSM.StartCoroutine(kicking(8f));
|
||||
oSM.GetComponent<Animator>().SetBool("isAerialKick", true);
|
||||
}
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState 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(OffenseStateManager oSM){
|
||||
|
||||
@@ -15,7 +15,7 @@ public class OffenseKickState : OffenseBaseState
|
||||
kicked = false; // haven't kicked
|
||||
oSM.animator.SetBool("IsKickingIdle", true);
|
||||
//start kicking routine
|
||||
oSM.StartCoroutine(kicking(1f));
|
||||
oSM.StartCoroutine(kicking(.833f));
|
||||
}
|
||||
|
||||
public override void ExitState(OffenseStateManager oSM, OffenseBaseState nextState){
|
||||
|
||||
Reference in New Issue
Block a user