Esempio n. 1
0
        /// <summary>
        /// Called when an object stop touching the collider.
        /// </summary>
        /// <param name="other">The other's game object collider.</param>
        void OnTriggerExit(Collider other)
        {
            GameObjectController.Destroy(other.gameObject, true);

            Debug.Log(string.Format("Destroyed By World Boundary {3} - Position ({0},{1},{2}", other.transform.position.x, other.transform.position.y,
                                    other.transform.position.z, other.gameObject.name));
        }
Esempio n. 2
0
        private void OnTriggerEnter(Collider other)
        {
            if (other.tag.Equals("WorldBoundary") || other.tag == "Enemy" || other.tag == "EnemyRed" || other.tag == "EnemyBolt")
            {
                return;
            }

            try
            {
                if (other.tag.Equals("Player") && (gameObject.tag.Equals("EnemyBolt") || gameObject.tag.Equals("Enemy") || gameObject.tag.Equals("EnemyRed")))
                {
                    GameObjectController.Instantiate(PlayerExplosion, other.transform.position, other.transform.rotation);
                    //GameObjectController.Destroy(gameObject);
                    //GameObjectController.Destroy(other.gameObject);
                    Debug.Log(string.Format("Destroyed By Contact - {0} Collided with {1}", gameObject.name, other.gameObject.name));
                    _gameControllerObject.IsPlayerAlive = false;
                }

                Debug.Log(other.name);

                if ((gameObject.tag.Equals("Enemy") || gameObject.tag.Equals("EnemyRed")) && other.tag.Equals("Bolt"))
                {
                    _gameControllerObject.EnemiesKilled++;
                    _gameControllerObject.AddScore(ScoreValue);
                }

                if (Explosion != null)
                {
                    GameObjectController.Instantiate(Explosion, transform.position, transform.rotation);
                }


                GameObjectController.Destroy(gameObject);
                GameObjectController.Destroy(other.gameObject);
                Debug.Log(string.Format("Destroyed By Contact - {0} Collided with {1}", gameObject.name, other.gameObject.name));
            }
            catch (Exception e)
            {
                Debug.Log(e.Message);
            }
        }