Пример #1
0
 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.CompareTag("Enermy"))
     {
         if (this.onFire)
         {
             EnemyWithFire enemy = collision.gameObject.GetComponentInParent <EnemyWithFire> ();
             enemy.Burned();
         }
     }
 }
Пример #2
0
    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Player"))
        {
            Player player = collision.gameObject.GetComponent <Player> ();
            player.Hit(damage);
//			print ("enemy hit player");
            // maybe add attack animation
        }

        if (collision.gameObject.CompareTag("Enermy"))
        {
            if (this.onFire)
            {
                EnemyWithFire enemy = collision.gameObject.GetComponentInParent <EnemyWithFire> ();
                enemy.Burned();
            }
        }
    }