Ejemplo n.º 1
0
 private void OnTriggerExit2D(Collider2D other)
 {
     if (other.tag == ("Player"))
     {
         PlatformerCharacter2D player = other.GetComponent <PlatformerCharacter2D>();
         player.TakeHp(1000);
     }
     else if (other.tag == "Spells")
     {
         Destroy(other.gameObject);
     }
 }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
        private void Update()
        {
            Player1 = transform.GetChild(0).GetComponent <PlatformerCharacter2D>();
            if (Player1.Hp <= 0)
            {
                Player1.transform.gameObject.SetActive(false);
            }

            Player2 = transform.GetChild(1).GetComponent <PlatformerCharacter2D>();
            if (Player2.Hp <= 0)
            {
                Player2.transform.gameObject.SetActive(false);
            }
        }
Ejemplo n.º 4
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);
         }
     }
 }
Ejemplo n.º 5
0
 private void Awake()
 {
     character = GetComponent <PlatformerCharacter2D>();
 }