示例#1
0
文件: Mine.cs 项目: temik911/audio
 internal Mine(Submarine sub)
 {
     Texture = LogicService.mine;
     Parent = sub.Parent;
     Cell = sub.Cell;
     _noise = Config.NOISE_BOOM_MINE;
     Order = 3;
 }
示例#2
0
文件: AI.cs 项目: temik911/audio
 public virtual AIAction NextAction(Submarine sub, GameField field)
 {
     for (int i = 0; i < 5; i++)
         switch (rnd.Next(5))
         {
             case 0:
                 addMarker(new Aim(field.Field[rnd.Next(field.Height), rnd.Next(field.Width)]));
                 break;
             case 1:
                 addMarker(new Circle(field.Field[rnd.Next(field.Height), rnd.Next(field.Width)]));
                 break;
             case 2:
                 addMarker(new Check(field.Field[rnd.Next(field.Height), rnd.Next(field.Width)]));
                 break;
             case 3:
                 addMarker(new Flag(field.Field[rnd.Next(field.Height), rnd.Next(field.Width)]));
                 break;
             case 4:
                 addMarker(new XMark(field.Field[rnd.Next(field.Height), rnd.Next(field.Width)]));
                 break;
         }
     List<Cell> path;
     switch (rnd.Next(3))
     {
         case 0 :
             int count = rnd.Next(3) + 1;
             int moveX = rnd.Next(Config.FIELD_HEIGHT);
             int moveY = rnd.Next(Config.FIELD_WIDTH);
             while (field.Field[moveX, moveY].Type == CellType.LAND)
             {
                 moveX = rnd.Next(Config.FIELD_HEIGHT);
                 moveY = rnd.Next(Config.FIELD_WIDTH);
             }
             path = field.getPath(sub.Cell, field.Field[moveX, moveY]);
             if (path == null)
                 path = new List<Cell>();
             return new Move(path);
         case 1 :
             count = rnd.Next(3) + 1;
             moveX = rnd.Next(Config.FIELD_HEIGHT);
             moveY = rnd.Next(Config.FIELD_WIDTH);
             while (field.Field[moveX, moveY].Type == CellType.LAND)
             {
                 moveX = rnd.Next(Config.FIELD_HEIGHT);
                 moveY = rnd.Next(Config.FIELD_WIDTH);
             }
             path = field.getPath(sub.Cell, field.Field[moveX, moveY]);
             if (path == null)
                 path = new List<Cell>();
             return new PlaceMine(path);
         case 2 :
             int x = rnd.Next(Config.FIELD_HEIGHT);
             int y = rnd.Next(Config.FIELD_WIDTH);
             while ((field.Field[x, y].Type == CellType.LAND) || ((x == sub.Cell.I) && (y == sub.Cell.J)))
             {
                 x = rnd.Next(Config.FIELD_HEIGHT);
                 y = rnd.Next(Config.FIELD_WIDTH);
             }
             path = field.getPath(sub.Cell, field.Field[x, y]);
             return new LaunchTorpedo(path);
         default:
             return null;
     }
 }
示例#3
0
 public TorpedoDamage(Submarine submarine, ActionsQueue queue)
 {
     Entity = submarine;
     ActionsQueue = queue;
 }
示例#4
0
 internal void saveStep(EntityCollection collection, AIAction action, Submarine sub)
 {
     sw.WriteLine("Step {0}", LogicService.stepCount);
     saveCollection(collection);
     saveAction(action, sub);
     sw.WriteLine("End step {0}", LogicService.stepCount);
     sw.Flush();
 }
示例#5
0
 internal void saveAction(AIAction action, Submarine sub)
 {
     sw.WriteLine("Action");
     sw.WriteLine("Type");
     if (action is PlaceMine)
         sw.WriteLine("PlaceMine");
     if (action is LaunchTorpedo)
         sw.WriteLine("LaunchTorpedo");
     if (action is Move)
         sw.WriteLine("Move");
     sw.WriteLine("End type");
     sw.WriteLine("Path");
     foreach (Cell cell in action.path)
         sw.WriteLine(cell.I + " " + cell.J);
     sw.WriteLine("End path");
     sw.WriteLine("Submarine");
     sw.WriteLine(sub.Number);
     sw.WriteLine("End submarine");
     sw.WriteLine("End action");
     sw.Flush();
 }
示例#6
0
 public Accident(Submarine sub, Submarine sub1, ActionsQueue queue)
 {
     Entity = sub;
     this.sub1 = sub1;
     ActionsQueue = queue;
 }
示例#7
0
文件: Reload.cs 项目: temik911/audio
 public Reload(Submarine submarine)
 {
     Entity = submarine;
 }
示例#8
0
文件: Move.cs 项目: temik911/audio
 internal override void execute(Submarine sub, ActionsQueue queue)
 {
     queue.addAction(new SubmarinesGameLibrary.GameActions.ParsePath(sub, path, queue));
 }
示例#9
0
 internal override void execute(Submarine sub, ActionsQueue queue)
 {
     queue.addAction(new SubmarinesGameLibrary.GameActions.LaunchTorpedo(sub, path, queue));
 }
示例#10
0
 internal abstract void execute(Submarine sub, ActionsQueue queue);