Hi … I would like to ask about play animation on tower
I have my own 3d model swordsman and it has attack animation on it and see i have this tower defense game … My tower prefab is a swordsman, now when i put my tower on a platform how to activate its animation when the swordsman see the enemy like swing his sword
What i suggest is you make a cube (object) in the area Infront of the tower/Swordsman, with the mesh renderer off, then on cube collider select is trigger…
Then all you have to do is attach this script to the swordsman…
// C# code
void OnTriggerEnter(Collider Obj)
{
if(Obj.tag == "Enemy")
{
gameobject.Getcomponent<Animation>().Play("SwordSwing");
}
}
// Give the enemy obj the enemy tag
And if you have a giveDamage function you could call that as well… inside the area.
Wow thanks i’ll try it later…