I have a character in game with an idle, running, and walking animations working great. But what I am trying to do is call another animation like the attack or block animation and play the duration, then go back to playing the idle, or run animations. Right now if I trigger an attack or a block, the animation instantly cuts off and goes back to the idle, or moving animations. Any help would greatly be appreciated
void MovePlayer() {
if (Input.acceleration.y > -0.6)
{
//if (!PlayerAttack.isPlayerAttacking)
animation.Play("Run");
Vector3 forward = cc.transform.forward;
forward *= 2.7f;
forward.y = 0.0f;
cc.Move(forward * Time.deltaTime);
}
else if (Input.acceleration.y < -0.8)
{
//if (!PlayerAttack.isPlayerAttacking)
animation.Play("Walk");
Vector3 backward = -cc.transform.forward;
backward *= 2.7f;
backward.y = 0.0f;
cc.Move(backward * Time.deltaTime);
}
else
{
//if (!PlayerAttack.isPlayerAttacking)
animation.Play("Idle");
}
}
void Update()
{
// Finger swipe down
if (t.position.y > tBegin.position.y)
{
PlayerAttack.isPlayerAttacking = true;
animation.Play("OverheadSwing");
myDelay(3.0f);
pAttack.Attack();
//PlayerAttack.isPlayerAttacking = false;
}
}