示例#1
0
文件: BaseC.cs 项目: temik911/audio
 public BaseC(Cell cell, Team team)
 {
     Cell = cell;
     Parent = team;
     Texture = LogicService.baseC;
     Order = 1;
 }
示例#2
0
文件: Mine.cs 项目: temik911/audio
 internal Mine(Cell cell, Team team)
 {
     Texture = LogicService.mine;
     Parent = team;
     Cell = cell;
     _noise = Config.NOISE_BOOM_MINE;
     Order = 3;
 }
示例#3
0
 internal Submarine(Cell cell, Team team, Texture2D texture, int number, int health, int tCount, int mCount)
 {
     this.Cell = cell;
     this.X = cell.X - Config.OffsetX;
     this.Y = cell.Y - Config.OffsetY;
     this.Parent = team;
     this._healths = health;
     this.Texture = texture;
     this._health = LogicService.health;
     Order = 5;
     _number = number;
     _torpedoCount = tCount;
     _minesCount = mCount;
 }
示例#4
0
 public Submarine(Cell cell, Team team, Texture2D texture)
 {
     this.Cell = cell;
     this.X = cell.X - Config.OffsetX;
     this.Y = cell.Y - Config.OffsetY;
     this.Parent = team;
     this._healths = 3;
     this.Texture = texture;
     this._health = LogicService.health;
     Order = 5;
     _number = count;
     count++;
     _torpedoCount = Config.TORPEDO_COUNT;
     _minesCount = Config.MINES_COUNT;
 }
示例#5
0
 internal void saveTeam(Team team)
 {
     sw.WriteLine("Team {0}", team.TeamId);
     sw.WriteLine("Base cells");
     foreach (BaseC cell in team.getBases())
         sw.WriteLine(cell.Cell.I + " " + cell.Cell.J);
     sw.WriteLine("End base cells");
     sw.WriteLine("Submarines");
     foreach (Submarine sub in team.getSubmarines())
         sw.WriteLine(sub.Cell.I + " " + sub.Cell.J + " " + sub.Number + " " + sub.Health + " " + sub.TorpedoCount + " " + sub.MinesCount);
     sw.WriteLine("End submarines");
     sw.WriteLine("Mines");
     foreach (Mine mine in team.getMines())
         sw.WriteLine(mine.Cell.I + " " + mine.Cell.J);
     sw.WriteLine("End mines");
     sw.WriteLine("End team {0}", team.TeamId);
     sw.Flush();
 }
示例#6
0
 internal Team readTeam(int teamId, GameField field)
 {
     Team team = new Team(teamId, new AI(), field);
     String str = sr.ReadLine();
     while (!str.Contains("End team"))
     {
         if (str.Equals("Base cells"))
         {
             str = sr.ReadLine();
             while (!str.Equals("End base cells"))
             {
                 team.addToCollection(new BaseC(field.Field[Int32.Parse(str.Split(' ').ElementAt(0)), Int32.Parse(str.Split(' ').ElementAt(1))], team));
                 str = sr.ReadLine();
             }
         }
         if (str.Equals("Submarines"))
         {
             str = sr.ReadLine();
             while (!str.Equals("End submarines"))
             {
                 team.addToCollection(new Submarine(field.Field[Int32.Parse(str.Split(' ').ElementAt(0)), Int32.Parse(str.Split(' ').ElementAt(1))],
                                                    team, team.TeamId == 0 ? LogicService.submarineL : LogicService.submarineR, Int32.Parse(str.Split(' ').ElementAt(2)),
                                                    Int32.Parse(str.Split(' ').ElementAt(3)), Int32.Parse(str.Split(' ').ElementAt(4)), Int32.Parse(str.Split(' ').ElementAt(5))));
                 str = sr.ReadLine();
             }
         }
         if (str.Equals("Mines"))
         {
             str = sr.ReadLine();
             while (!str.Equals("End mines"))
             {
                 team.addToCollection(new Mine(field.Field[Int32.Parse(str.Split(' ').ElementAt(0)), Int32.Parse(str.Split(' ').ElementAt(1))], team));
                 str = sr.ReadLine();
             }
         }
         str = sr.ReadLine();
     }
     return team;
 }
示例#7
0
 public EntityCollection()
 {
     collection = new List <VisibleObject>();
     winner     = null;
 }
示例#8
0
文件: Team.cs 项目: temik911/audio
 internal override VisibleObject Copy(VisibleObject parent)
 {
     Team newTeam = new Team(TeamId, AI, Field);
     newTeam.InitForReplay((EntityCollection)parent);
     foreach (VisibleObject obj in Collection)
         newTeam.addToCollection(obj.Copy(newTeam));
     return newTeam;
 }
示例#9
-1
 public void reset()
 {
     GameCollection = new EntityCollection();
     queue = new ActionsQueue(GameCollection, Game.GetService<GameFieldService>().GameField);
     Team teamR = new Team(0, LoadAI(0), Game.GetService<GameFieldService>().GameField);
     Team teamL = new Team(1, LoadAI(1), Game.GetService<GameFieldService>().GameField);
     GameCollection.addToCollection(teamR);
     GameCollection.addToCollection(teamL);
     teamR.Initialize(GameCollection, submarineR);
     teamL.Initialize(GameCollection, submarineL);
 }