예제 #1
0
        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);
        }
예제 #2
0
 public override bool execute(GameTime gameTime)
 {
     if (Entity != null)
     {
         ActionsQueue.addAction(new ParsePath(Entity, path, ActionsQueue), 1);
     }
     return(true);
 }
예제 #3
0
        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);
        }
예제 #4
0
 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);
 }
예제 #5
0
파일: Move.cs 프로젝트: temik911/audio
 internal override void execute(Submarine sub, ActionsQueue queue)
 {
     queue.addAction(new SubmarinesGameLibrary.GameActions.ParsePath(sub, path, queue));
 }
예제 #6
0
 internal override void execute(Submarine sub, ActionsQueue queue)
 {
     queue.addAction(new SubmarinesGameLibrary.GameActions.LaunchTorpedo(sub, path, queue));
 }