Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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;
            }
        }