Quantcast
Viewing all articles
Browse latest Browse all 1488

enemies Scoring points killed

Hello, how can I make a score for each killed enemy? I tried to follow this guide: https://unity3d.com/learn/tutorials/projects/survival-shooter-tutorial/scoring-points But can not I :( In my code I also use the spawning of the enemies and it is the following: **Enemy script manager** public class Zombie : MonoBehaviour { protected float damage = 1.0f; protected float health = 1.0f; protected float velocityFactor = 1.0f; protected NavMeshAgent agent; protected ParticleSystem explosion; void Update(){ agent.destination = GameManager.GetCharacter ().transform.position; if(!explosion.IsAlive() && explosion.gameObject.activeSelf){ Death (); } } public void SetVelocity(float value){ agent.speed = value; } public void SetDamage(float value){ damage = value; } public void SetHealth(float value){ health = value; } public float GetVelocity(){ return agent.speed; } public float GetHealth(){ return health; } public float GetDamage(){ return damage; } void ApplyDamage(float damage) { if (health <= 0.0f) { StartExplosionParticle (); } health = health - 1; } void OnCollisionEnter (Collision coll) { if (coll.gameObject.tag == "Bullet") { ApplyDamage (1.0f); } if (coll.gameObject.tag == "Bullet") { ApplyDamage (1.0f); } if (coll.gameObject.tag == "Bullet") { ApplyDamage (1.0f); } } private void Death(){ Destroy (gameObject); GameManager.spooneEngine.GetCurrentWave ().Remove (gameObject); } private void StartExplosionParticle(){ gameObject.GetComponent ().enabled = false; gameObject.GetComponent ().enabled = false; explosion.gameObject.SetActive (true); explosion.Play (); } } **And in every enemy he has this script:** public class FatZombie : Zombie { void Awake(){ explosion = transform.GetChild (0).GetComponent (); agent = GetComponent (); health = 5.0f; damage = 2.0f; velocityFactor = 1.5f; } public float GetVelocityFactor(){ return velocityFactor; } } how can I do?

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>