Example #1
0
        //-----------------------------------------------------------------------------------------------------
        void OnCollisionEnter(UnityEngine.Collision other)
        {
            if (other.gameObject.tag == "Alien")
            {
                var alien = other.gameObject.GetComponent <ALIEN>();

                alien.Hit();

                //Add Score
                PLAYER.AddScore(10);

//				Destroy(collider.gameObject);

                Destroy(LaserObject);
            }
        }
Example #2
0
        //====================================================================================================
        // ■ HIT
        //====================================================================================================
        public void Hit(int hit = 1)
        {
            HitFlag = true;
            HitTime = TIME.realtimeSinceStartup;

            HitCount -= hit;
            HitCount  = math.max(0, HitCount);

            if (HitCount == 0)
            {
                PLAYER.AddScore(100);

                Destroy(GameObject, 1.0f);
                Die = true;

                var camera = GAMEOBJECT.Find("Main Camera").Camera;
                ScorePosition = camera.WorldToScreenPoint(transform.position);
            }

            Color = COLOR.white;
            Scale = 1.5f;

            GameObject.AudioSource.Play();
        }