internal Mine(Submarine sub) { Texture = LogicService.mine; Parent = sub.Parent; Cell = sub.Cell; _noise = Config.NOISE_BOOM_MINE; Order = 3; }
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; } }
public TorpedoDamage(Submarine submarine, ActionsQueue queue) { Entity = submarine; ActionsQueue = queue; }
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(); }
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(); }
public Accident(Submarine sub, Submarine sub1, ActionsQueue queue) { Entity = sub; this.sub1 = sub1; ActionsQueue = queue; }
public Reload(Submarine submarine) { Entity = submarine; }
internal override void execute(Submarine sub, ActionsQueue queue) { queue.addAction(new SubmarinesGameLibrary.GameActions.ParsePath(sub, path, queue)); }
internal override void execute(Submarine sub, ActionsQueue queue) { queue.addAction(new SubmarinesGameLibrary.GameActions.LaunchTorpedo(sub, path, queue)); }
internal abstract void execute(Submarine sub, ActionsQueue queue);