private void MartianKilled(Martian martian)
        {
            SaveData.score += martian.RewardPoints;
            this.levelUI.UpdateScoreText();

            this.SpawnMartian();
        }
예제 #2
0
        private void SearchForEnemy()
        {
            Martian martian;

            if (this.IsOverlapingTarget(out martian))
            {
                this.martian = martian;
                this.SetState(State.Locking);
            }
        }
예제 #3
0
        private bool IsOverlapingTarget(out Martian martian)
        {
            martian = null;
            // Find all of the colliders on this layerMask overlaping our Reticle
            Collider2D[] hitColliders = Physics2D.OverlapCircleAll(this.transform.position, this.reticleRadius, this.layerMask);

            for (int i = 0; i < hitColliders.Length; i++)
            {
                Martian tempMartian = hitColliders[i].GetComponentInParent <Martian>();
                if (tempMartian != null)
                {
                    martian = tempMartian;
                    return(true);
                }
            }
            return(false);
        }
        private void SpawnMartian()
        {
            Martian martian = Instantiate <Martian>(this.martianPrefab, this.GetRandomSpawnPosition(), Quaternion.identity);

            martian.transform.SetParent(this.martianContainer);
        }