#Transitions happen before OnStateEnter() called?
1 messages · Page 1 of 1 (latest)
here's the transition to the state
...the behavior attached to the attack state
public AnimationCurve[] punchVelocity;
float _timer = 0;
int _punchType;
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
_timer = 0;
_punchType = Random.Range(0, 3);
animator.SetInteger("PunchType", _punchType );
manager = animator.GetComponent<GruntManager>();
if (manager)
{
if (_punchType == 2) manager.SetTurnSpeed(0);
else manager.ResetTurnSpeed();
}
animator.SetBool("IsAttacking", true);
}
override public void OnStateMachineExit(Animator animator, int stateMachinePathHash)
{
animator.SetBool("IsAttacking", false);
}
``` relevant c# code
these 3 animations are played depending on what index was randomly selected