public void OnMinionDeath(object sender, MinionDeathArgs args)
 {
     _kills++;
     killsText.text = KillText;
     _score += args.Points;
     scoreText.text = ScoreText;
     //Debug.Log("A minion died!");
 }
Example #2
0
        /*public void Damage(float damage, string damageType, int damageDuration)
        {
            switch(damageType)
            {
                case "DPS":
                    health -= damage;
                    break;
                case "FIRE":
                    StartCoroutine(ApplyDOT(damage, damageDuration));
                    break;
                case "ICE":
                    StartCoroutine(ApplySlow(damage, damageDuration));
                    break;
            }
            //health -= damage;
            if(health <= 0.0f)
            {
                Die();
            }
        }

        IEnumerator ApplyDOT(float damage, int duration)
        {
            //TODO: Apply area effect
            Debug.Log("Fire Hit");
            health -= damage;

            if(health <= 0.0f)
            {
                Die();
            }

            duration--;
            yield return new WaitForSeconds(1f);
            if(duration > 0)
            {
                StartCoroutine(ApplyDOT(damage, duration));
            }
        }

        IEnumerator ApplySlow(float damage, int duration)
        {
            //TODO: Apply area effect
            //These are temp numbers for testing, pre balancing
            health -= (damage / 2);
            agent.speed = (speed / 2);

            if(health <= 0.0f)
            {
                Die();
            }

            duration--;
            yield return new WaitForSeconds(1.5f);
            if(duration > 0)
            {
                StartCoroutine(ApplySlow(damage, duration));
            }
            else
            {
                if(health > 0.0f)
                {
                    agent.speed = speed;
                }
            }
        }*/
        public void Die()
        {
            if (MinionDeathEvent != null) {
                MinionDeathArgs mda = new MinionDeathArgs();
                mda.Points = points;
                MinionDeathEvent(this, mda);
                MinionDeathEvent = null;
            }
            isAlive = false;
            Destroy(gameObject);
        }