public Move(Entity sub, Cell to, ActionsQueue queue, float speed, double noise) { k++; Entity = sub; this.to = to; ActionsQueue = queue; Noise = noise; _speed = speed; }
public Check(Entity entity, ActionsQueue queue, Double noise, Cell to, Cell from, float speed) { this.noise = noise; this.queue = queue; this.entity = entity; this.to = to; this.from = from; this.speed = speed; }
public LaunchTorpedo(Entity entity, List<Cell> path, ActionsQueue queue) { if (((Submarine)entity).launchTorpedo()) { ((Submarine)entity).Team.launchedTorpedo++; Entity = new Torpedo((Submarine)entity); entity.Parent.addToCollection(Entity); } else Entity = null; ActionsQueue = queue; this.path = path; }
public ParsePath(Entity entity, List<Cell> path, ActionsQueue queue) { Entity = entity; ActionsQueue = queue; this.path = new List<Cell>(); this.path.AddRange(path); if (Entity is Submarine) { if (this.path.Count > 4) this.path.RemoveRange(4, this.path.Count - 4); switch (this.path.Count) { case 0: Noise = 0; _speed = 1.0f * Config.SPEED; break; case 1: Noise = 0; _speed = 1.0f * Config.SPEED; break; case 2: Noise = Config.NOISE_1_STEP; _speed = 1.0f * Config.SPEED; break; case 3: Noise = Config.NOISE_2_STEP; _speed = 1.5f * Config.SPEED; break; case 4: Noise = Config.NOISE_3_STEP; _speed = 2.0f * Config.SPEED; break; } } if (Entity is Torpedo) { if (this.path.Count > 13) this.path.RemoveRange(13, path.Count - 13); Noise = Config.NOISE_TORPEDO_STEP; _speed = 3.0f * Config.SPEED; } }
public override void Update(GameTime gameTime) { if (!pause) { if (IsFirst) { gameCollection = (EntityCollection)rm.ReadInitPos(Game.GetService<GameFieldService>().GameField).Copy(null); stepList = rm.ReadGame(Game.GetService<GameFieldService>().GameField); gameCollection = (EntityCollection)stepList.Find(x => x.stepNumb == k).collection.Copy(null); queue = new ActionsQueue(gameCollection, Game.GetService<GameFieldService>().GameField); IsFirst = false; } else { gameCollection.Update(gameTime); if (queue.Size == 0) { if (k <= stepList.Count) { gameCollection.GlobalUpdate(); ReplayStep step = stepList.Find(x => x.stepNumb == k); k++; if (step.action != null) step.action.action.execute(gameCollection.getSubmarines().Find(x => x.Number == step.action.subNumb), queue); } } else { queue.nextAction(gameTime); if (queue.Size == 0) { Game.GetService<GameFieldService>().GameField.coolNoise(); Game.GetService<GameFieldService>().GameField.calculateNoise(); } } } } base.Update(gameTime); }
public PlaceMine(Entity entity, ActionsQueue queue) { Entity = entity; ActionsQueue = queue; }
public ActivateMine(Entity mine, ActionsQueue queue) { Entity = mine; ActionsQueue = queue; }
internal abstract void execute(Submarine sub, ActionsQueue queue);
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)); }
public Bang(Entity entity, ActionsQueue queue) { Entity = entity; ActionsQueue = queue; }
public Accident(Submarine sub, Submarine sub1, ActionsQueue queue) { Entity = sub; this.sub1 = sub1; ActionsQueue = queue; }
public TorpedoDamage(Submarine submarine, ActionsQueue queue) { Entity = submarine; ActionsQueue = queue; }
public MineDamage(Submarine submarine, ActionsQueue queue) { Entity = submarine; ActionsQueue = queue; }
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); }