- Home /
Question by
$$anonymous$$ · Aug 08, 2019 at 02:42 AM ·
animationparticlesystemtexturesshieldhealth
How would I do enemy damage animation?
Hi, I was wondering how I do enemy damage animation? Like when the enemy or players energy shields hit 0 it would play a animation and activate a texture and a particle effect.
here's the script.
using UnityEngine;
using System.Collections;
public class EnemyHealth : MonoBehaviour {
public int health = 100;
public Animator Damage;
void Update()
{
if (health <= 0)
{
Debug.Log ("Enemy Health is working");
Dead ();
}
}
public void ApplyDamage(int damageToTake)
{
damageToTake = 50;
health -= damageToTake;
}
void Dead()
{
Destroy (gameObject);
}
}
Comment
Your answer
Follow this Question
Related Questions
Cant set animation to legacy 4 Answers
Animating a texture, what method should I use? 0 Answers
Shield texture (multiple) textures 2 Answers
ParticleSystem or play a video? 1 Answer
Problem with HealthBar 1 Answer