Exemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Boss")
     {
         GetComponent <Animator>().SetTrigger("impact");
         rb.velocity = transform.right * 0;
         GameObject gO = collision.gameObject;
         boss = gO.GetComponent <Boss>();
         float damage = PlayerPrefs.GetFloat("playerDamge");
         boss.SendMessageUpwards("Damage", damage);
         boss.gO(gO);
     }
     else if (collision.tag == "Enemy2")
     {
         GetComponent <Animator>().SetTrigger("impact");
         rb.velocity = transform.right * 0;
         GameObject gO = collision.gameObject;
         enemy2 = gO.GetComponent <Enemy2>();
         float damage = PlayerPrefs.GetFloat("playerDamge");
         enemy2.SendMessageUpwards("Damage", damage);
         enemy2.gO(gO);
     }
     else if (collision.tag == "Enemy3")
     {
         GetComponent <Animator>().SetTrigger("impact");
         rb.velocity = transform.right * 0;
         GameObject gO = collision.gameObject;
         enemy3 = gO.GetComponent <Enemy3>();
         float damage = PlayerPrefs.GetFloat("playerDamge");
         enemy3.SendMessageUpwards("Damage", damage);
         enemy3.gO(gO);
     }
     else if (collision.tag == "Enemy4")
     {
         GetComponent <Animator>().SetTrigger("impact");
         rb.velocity = transform.right * 0;
         GameObject gO = collision.gameObject;
         enemy4 = gO.GetComponent <Enemy4>();
         float damage = PlayerPrefs.GetFloat("playerDamge");
         enemy4.SendMessageUpwards("Damage", damage);
         enemy4.gO(gO);
     }
 }