private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.name.Equals("arbol")) { ControlArbol ctr = other.gameObject.GetComponent <ControlArbol>(); if (ctr != null) { ctr.RecibirDisparo(); } Destroy(gameObject); } if (other.gameObject.name.Equals("orc")) { ControlOrco ctr = other.gameObject.GetComponent <ControlOrco>(); if (ctr != null) { ctr.RecibirBala(); } Destroy(gameObject); } }
public void SetControlArbol(ControlArbol ctr) { ctrArbol = ctr; }