Ejemplo n.º 1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "player")
     {
         p1 = GameObject.Find("player").GetComponent <player>();
         if (p1 != null)
         {
             Debug.Log("player hit by laser");
             p1.Damageplayer();
         }
         Destroy(this.gameObject);
     }
 }
Ejemplo n.º 2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "player")
        {
            player pl = other.transform.GetComponent <player>();

            if (pl != null)
            {
                pl.Damageplayer();
            }
            speed = 0;
            an.SetTrigger("ontrigger");

            Destroy(this.gameObject, 2.4f);
        }
        else if (other.tag == "laser")
        {
            Destroy(other.gameObject);
            p1.scoreadder();
            speed = 0;
            an.SetTrigger("ontrigger");
            Destroy(this.gameObject, 2.4f);
        }
    }