void OnTriggerEnter2D(Collider2D other) { if (tag != other.gameObject.tag && other.gameObject.tag.Contains("Unit")) { audioManager.playMinionCollision(); GameObject e = GameObject.Instantiate(burstManagerPrefab, this.transform.position, Quaternion.LookRotation(Vector3.forward, Vector3.forward)) as GameObject; BurstManager BM = e.GetComponent <BurstManager> (); if (BM != null) { if (rogue) { BM.isRogue = true; } e.transform.position = this.transform.position; } } else if (tag != other.gameObject.tag && other.gameObject.tag.Contains("Bomb") && other.gameObject.GetComponent <BombParticleBehavior>().myOwner != myOwner) { Debug.Log("Unit belongs to: " + myOwner + " killed by " + other.gameObject.GetComponent <BombParticleBehavior>().myOwner); makeBurst(); makeBomb(other.gameObject.GetComponent <BombParticleBehavior>().myOwner); GameObject.Destroy(other.gameObject); GameObject.Destroy(this.gameObject); return; } if (tag != other.gameObject.tag && other.gameObject.tag.Contains("Unit")) { //audioManager.playMinionCollision(); GameObject.Destroy(other.gameObject); } }
public void makeBurst() { GameObject e = GameObject.Instantiate(burstManagerPrefab, this.transform.position, Quaternion.LookRotation(Vector3.forward, Vector3.forward)) as GameObject; BurstManager BM = e.GetComponent <BurstManager>(); if (BM != null) { if (rogue) { BM.isRogue = true; } e.transform.position = this.transform.position; } }