public override bool execute(GameTime gameTime) { Stopwatch timer = new Stopwatch(); timer.Start(); if (!checkPath()) { return(true); } List <Action> actionList = new List <Action>(); for (int i = 0; i < path.Count - 1; i++) { if (!new Check(Entity, ActionsQueue, Noise, path[i + 1], path[i], _speed).CheckState(ref actionList)) { break; } } for (int i = 0; i < actionList.Count; i++) { ActionsQueue.addAction(actionList[i], i + 1); } if (Entity is Torpedo) { ActionsQueue.addAction(new Bang(Entity, ActionsQueue)); } timer.Stop(); //Console.WriteLine("ParsePath. FrameID: " + gameTime.FrameID + ". Time: " + timer.Elapsed); return(true); }
public override bool execute(GameTime gameTime) { if (Entity != null) { ActionsQueue.addAction(new ParsePath(Entity, path, ActionsQueue), 1); } return(true); }
public override bool execute(GameTime gameTime) { Submarine sub = Entity as Submarine; if ((sub.Cell.Type == CellType.SHALLOW) && (sub.placeMine())) { sub.Team.placedMines++; Mine mine = new Mine(sub); sub.Parent.addToCollection(mine); ActivateMine act = new ActivateMine(mine, ActionsQueue); act.setSubs(((EntityCollection)sub.Team.Parent).getSubmarines()); ActionsQueue.addAction(act); } return(true); }
public override bool execute(GameTime gameTime) { if (Entity != null) { Mine mine = Entity as Mine; mine.activate(); foreach (Submarine sub in submarines) { if (mine.Cell == sub.Cell) { ActionsQueue.addAction(new Bang(mine, ActionsQueue)); ActionsQueue.addAction(new MineDamage(sub, ActionsQueue)); } } } return(true); }
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)); }