Esempio n. 1
0
 public void DestroyEnemyTank(EnemyTank eTank)
 {
     if (EnemyTanks.Contains(eTank))
     {
         GameObject.Destroy(eTank.gameObject);
         EnemyTanks.Remove(eTank);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 设置地方坦克坐标
        /// </summary>
        /// <param name="point"></param>
        /// <param name="tankId"></param>
        private void SetEnemyLocation(Point point, string tankId)
        {
            TankInfo info = EnemyTanks.FirstOrDefault(p => p.TId.Equals(tankId));

            if (info != null && info.ShengYuShengMing > 0)
            {
                info.Location = point;
            }
        }
Esempio n. 3
0
        private void PopulateState(BaseItem item)
        {
            if (item is Empty empty)
            {
                EmptyItems.Add(empty);
                return;
            }

            if (item is AiTank aiTank)
            {
                AiTanks.Add(aiTank);

                if (item is AiPrizeTank aiPrizeTank)
                {
                    AiPrizeTanks.Add(aiPrizeTank);
                }

                return;
            }

            if (item is EnemyTank enemyTank)
            {
                EnemyTanks.Add(enemyTank);
                return;
            }

            if (item is MyTank myTank)
            {
                MyTank = myTank;
                return;
            }

            if (item is Bullet bullet)
            {
                Bullets.Add(bullet);
                return;
            }

            if (item is River river)
            {
                Rivers.Add(river);
                return;
            }

            if (item is Tree tree)
            {
                Trees.Add(tree);
                return;
            }

            if (item is Ice ice)
            {
                Ice.Add(ice);
                return;
            }
        }
Esempio n. 4
0
        public void DestroyAllEnemyTanks()
        {
            EnemyTanks.RemoveAll(pr =>
            {
                GameObject.Destroy(pr.gameObject);
                return(true);
            });

            EnemyTanks.Clear();
        }
Esempio n. 5
0
        public void Clear()
        {
            EnemyTanks.Clear();
            EnemySamolets.Clear();
            EnemyCopters.Clear();
            EnemyZeneitkas.Clear();
            EnemyRemonts.Clear();

            Facility   = null;
            Squad      = null;
            TagetSquad = 0;

            IsEnemyCell = false;
            IsFight     = false;
        }
Esempio n. 6
0
        private void FillTanks()
        {
            if (SourceInfo.Boss.Tanks != null && SourceInfo.Boss.Tanks.Count > 0)
            {
                BossInfo = SourceInfo.Boss.Tanks[0];
            }

            GodCount = SourceInfo.Gold + SourceInfo.Extend;
            if (SourceInfo.Team.Equals("tB"))
            {
                if (SharedResources.OurTanks == null)
                {
                    SharedResources.OurTanks = new List <TankInfo>();
                    SharedResources.OurTanks.AddRange(SourceInfo.TeamB.Tanks);
                }
                else
                {
                    foreach (TankInfo ftan in SharedResources.OurTanks)
                    {
                        ftan.UpdateInfo(SourceInfo.TeamB.Tanks);
                    }
                }
                EnemyTanks.AddRange(SourceInfo.TeamC.Tanks);
                enemy = "C";
            }
            if (SourceInfo.Team.Equals("tC"))
            {
                if (SharedResources.OurTanks == null)
                {
                    SharedResources.OurTanks = new List <TankInfo>();
                    SharedResources.OurTanks.AddRange(SourceInfo.TeamC.Tanks);
                }
                else
                {
                    foreach (TankInfo ftan in SharedResources.OurTanks)
                    {
                        ftan.UpdateInfo(SourceInfo.TeamC.Tanks);
                    }
                }
                EnemyTanks.AddRange(SourceInfo.TeamB.Tanks);
                enemy = "B";
            }
            mapRow = SourceInfo.MapInfo.Map.GetLength(0);
            mapCol = SourceInfo.MapInfo.Map.GetLength(1);
            for (int i = 0; i < mapRow; i++)
            {
                for (int j = 0; j < mapCol; j++)
                {
                    switch (SourceInfo.MapInfo.Map[i, j])
                    {
                    case "M1": break;

                    case "M2":
                        GodB.Add(new Point(i, j));
                        break;

                    case "M3":
                        Fogs.Add(new Point(i, j));
                        break;

                    case "M4":
                        break;

                    case "M5": break;

                    case "M6": break;

                    case "M7": break;

                    case "M8": break;

                    case "A1":
                        if (BossInfo != null)
                        {
                            BossInfo.Location = new Point(i, j);
                        }
                        break;

                    case "B1":
                    case "B2":
                    case "B3":
                    case "B4":
                    case "B5":
                        if (enemy == "B")
                        {
                            SetEnemyLocation(new Point(i, j), SourceInfo.MapInfo.Map[i, j]);
                        }
                        else
                        {
                            SetOurLocation(new Point(i, j), SourceInfo.MapInfo.Map[i, j]);
                        }
                        break;

                    case "C1":
                    case "C2":
                    case "C3":
                    case "C4":
                    case "C5":
                        if (enemy == "C")
                        {
                            SetEnemyLocation(new Point(i, j), SourceInfo.MapInfo.Map[i, j]);
                        }
                        else
                        {
                            SetOurLocation(new Point(i, j), SourceInfo.MapInfo.Map[i, j]);
                        }
                        break;
                    }
                }
            }
            if (GodB.Count > 0)
            {
                SetGodTank();
            }
        }
Esempio n. 7
0
 public void AddEnemyTank(EnemyTank eTank)
 {
     EnemyTanks.Add(eTank);
 }