private void OnTriggerEnter2D(Collider2D collider) { NewHero NewHero = collider.GetComponent <NewHero>(); if (NewHero) { NewHero.ReciveDamage(1); Destroy(gameObject); BulletDestroy.BangHere(collider.transform); } bulletHero bulletHero = collider.GetComponent <bulletHero>(); if (bulletHero) { Destroy(gameObject); BulletDestroy.BangHere(collider.transform); } BulletDestroy bd = collider.GetComponent <BulletDestroy>(); if (bd && bd.gameObject != parent) { Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D collider) { BulletDestroy unit = collider.GetComponent <BulletDestroy>(); if (unit && unit.gameObject != parent) { trigger trigger = collider.GetComponent <trigger>(); if (!trigger) { Destroy(gameObject); } } Monster Monster = collider.GetComponent <Monster>(); if (Monster) { Destroy(gameObject); BulletDestroy.BangHere(collider.transform); } EmenyBullet emenyBullet = collider.GetComponent <EmenyBullet>(); if (emenyBullet) { Destroy(gameObject); } }
void Start() { target = null; enemies = new List <Transform> (); AddEnemiesToList(); bulletDestroy = GetComponent <BulletDestroy>(); speed = bulletDestroy.speed; //StartCoroutine (AutoExplode ()); }
private void OnCollisionEnter2D(Collision2D collision) { NewHero NewHero = collision.gameObject.GetComponent <NewHero>(); if (NewHero) { NewHero.ReciveDamage(1); Destroy(gameObject); BulletDestroy.BangHere(GetComponent <Collider2D>().transform); } bulletHero bulletHero = collision.gameObject.GetComponent <bulletHero>(); if (bulletHero) { Destroy(gameObject); BulletDestroy.BangHere(GetComponent <Collider2D>().transform); } }
// Start is called before the first frame update void Awake() { rb = GetComponent <Rigidbody2D>(); bdScript = GetComponent <BulletDestroy>(); }
public virtual void Start() { bulletDestroyer = gameObject.GetComponent<BulletDestroy>(); }