- Home /
Animtor Stuck
So To Begin i Have This Code
public void Attack(int attackSide){
Anim.SetInteger("Action", attackSide);
Anim.SetBool("Animate", true);
StartCoroutine(_LockMovementAndAttack(0f, 1.7f));
}
public IEnumerator _LockMovementAndAttack(float delayTime, float lockTime){
if (CA.animators[0].GetInteger("Action") != 0)
{
Anim.SetBool("Animate", true);
}
yield return new WaitForSeconds(delayTime);
canAction = false;
canMove = false;
Anim.SetBool("Moving", false);
Anim.SetBool("Animate", false);
rb.velocity = Vector3.zero;
rb.angularVelocity = Vector3.zero;
inputVec = new Vector3(0, 0, 0);
Anim.applyRootMotion = true;
if (CA.animators[0].GetCurrentAnimatorStateInfo(0).IsName("Unarmed-Idle"))
{
canAction = true;
canMove = true;
}
else
{
//yield return new
yield return new WaitForSeconds(lockTime);
canAction = true;
canMove = true;
}
}
And i call the Attack Void with this
if (canAction)
{
if (Input.GetKeyDown(KeyCode.Alpha1)){
Attack(1);
}
}
Comment
Answer by Joey_pc · Sep 13, 2018 at 04:27 PM
It Works But If Get Stuck Like 75% of The Time Here Is My Animator