Esempio n. 1
0
        private void OnCollisionEnter2D(Collision2D other)
        {
            PlatformerCharacter2D player = other.collider.GetComponent <PlatformerCharacter2D>();

            if (GetComponent <Spell_2>().NumberOfPlayer != player.GetComponent <PlatformerCharacter2D>().NumberOfPlayer)
            {
                player.TakeHp(Demage);
            }
            if (GetComponent <Spell_2>().NumberOfPlayer == player.GetComponent <PlatformerCharacter2D>().NumberOfPlayer)
            {
                Physics2D.IgnoreCollision(other.collider, GetComponent <Collider2D>(), true);
            }
        }
Esempio n. 2
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == ("Platform"))
     {
         Destroy(gameObject);
     }
     else if (other.tag == ("Player"))
     {
         PlatformerCharacter2D player = other.GetComponent <PlatformerCharacter2D>();
         if (GetComponent <Spell1>().NumberOfPlayer != player.GetComponent <PlatformerCharacter2D>().NumberOfPlayer)
         {
             player.TakeHp(Demage);
             Destroy(gameObject);
         }
     }
 }