Почему у зомби не идет анимация атаки?
Ну тоесть вот:
YouTube Видео
Код:
void OnTriggerStay(Collider other)
{
if (other.gameObject.TryGetComponent(out Player player))
{
stop = true;
anim.SetBool("Run", false);
anim.SetBool("Idle", false);
anim.SetBool("Walk", false);
anim.SetBool("Attack", true);
if (runner) player.hp -= 30 * Time.deltaTime;
else player.hp -= 20 * Time.deltaTime;
}
else if (other.gameObject.TryGetComponent(out Building building))
{
stop = true;
anim.SetBool("Run", false);
anim.SetBool("Idle", false);
anim.SetBool("Walk", false);
anim.SetBool("Attack", true);
if (runner) building.hp -= 60 * Time.deltaTime;
else building.hp -= 40 * Time.deltaTime;
}
else
{
stop = false;
anim.SetBool("Attack", false);
}
}
private void OnTriggerExit(Collider other)
{
if (other.gameObject.tag == "Player")
{
stop = false;
anim.SetBool("Attack", false);
}
if (other.gameObject.tag == "Building")
{
stop = false;
anim.SetBool("Attack", false);
}
}
Помогите пож-та