Beispiel #1
0
        public void CheckBombSpot()
        {
            bombSpot = null;
            List <BombSpot> bsl = GameApp.GetInstance().GetGameScene().GetBombSpots();

            foreach (BombSpot bs in bsl)
            {
                bs.DoLogic();
                if (bs.CheckInSpot())
                {
                    bombSpot = bs;
                }
                else if (bs.isInstalling())
                {
                    bombSpot = bs;
                }
            }
        }
Beispiel #2
0
        public void CreateBombSpots()
        {
            //Add BombSpot into list
            bombSpotList = new List <BombSpot>();
            GameObject[] bsl       = GameObject.FindGameObjectsWithTag("BombSpot");
            List <int>   indexList = new List <int>();

            for (int i = 0; i < bsl.Length; i++)
            {
                indexList.Add(i);
            }


            //Random select 3 of the spots
            if (indexList.Count > 0)
            {
                int rnd = Random.Range(0, indexList.Count);
                int no1 = indexList[rnd];
                indexList.Remove(no1);
                rnd = Random.Range(0, indexList.Count - 1);
                int no2 = indexList[rnd];
                indexList.Remove(no2);
                rnd = Random.Range(0, indexList.Count - 2);
                int no3 = indexList[rnd];
                for (int i = 0; i < bsl.Length; i++)
                {
                    if (i != no1 && i != no2 && i != no3)
                    {
                        GameObject.Destroy(bsl[i]);
                    }
                    else
                    {
                        BombSpot bs = new BombSpot();
                        bs.bombSpotObj = bsl[i];
                        bsl[i].active  = true;
                        bs.Init();
                        bombSpotList.Add(bs);
                    }
                }
            }
        }