private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("EnemyDeath"))
     {
         enemyDeath.Kill();
     }
 }
示例#2
0
    public void MinusHealth(int health)
    {
        enemy.currHealth -= health;

        if (enemy.currHealth == 2)
        {
            // GameObject particleRadius = transform.Find("particleRadius").gameObject;
            enemyRadius = particleRadius.GetComponent <EnemyRadius>();
            enemyPlayerInteraction.DamageFeedback();
            // player
            enemyRadius.circleParticlesTwo.Stop();
            enemyRadius.circleParticlesTwo.gameObject.SetActive(false);
        }

        if (enemy.currHealth == 1)
        {
            //  GameObject particleRadius = transform.Find("particleRadius").gameObject;
            enemyRadius = particleRadius.GetComponent <EnemyRadius>();
            enemyPlayerInteraction.DamageFeedback();
            enemyRadius.circleParticlesOne.Stop();
            enemyRadius.circleParticlesOne.gameObject.SetActive(false);
        }

        if (enemy.currHealth <= 0)
        {
            // Debug.Log(enemy.currHealth);
            enemyDeath.Kill();
            //  Debug.Log("urp");


            //  Transform enemyChild = transform.Find("enemy mit joints");

            foreach (Transform gc in enemyChild)
            {
                if (gc.name == "Enemy")
                {
                    GameObject enemyGrandchild = gc.gameObject;

                    enemyDissolve = enemyGrandchild.GetComponent <EnemyDissolve>();

                    enemyDissolve.dissolveNow();
                }
            }
        }

        /*
         * else
         * {
         *
         *  StartCoroutine(MinusHealthCoroutine());
         *
         * }
         */
    }