Ejemplo n.º 1
0
 public Move(Entity sub, Cell to, ActionsQueue queue, float speed, double noise)
 {
     k++;
     Entity = sub;
     this.to = to;
     ActionsQueue = queue;
     Noise = noise;
     _speed = speed;
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
        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;
            }
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 public PlaceMine(Entity entity, ActionsQueue queue)
 {
     Entity       = entity;
     ActionsQueue = queue;
 }
Ejemplo n.º 7
0
 public ActivateMine(Entity mine, ActionsQueue queue)
 {
     Entity = mine;
     ActionsQueue = queue;
 }
Ejemplo n.º 8
0
 internal abstract void execute(Submarine sub, ActionsQueue queue);
Ejemplo n.º 9
0
 public PlaceMine(Entity entity, ActionsQueue queue)
 {
     Entity = entity;
     ActionsQueue = queue;
 }
Ejemplo n.º 10
0
 internal override void execute(Submarine sub, ActionsQueue queue)
 {
     queue.addAction(new SubmarinesGameLibrary.GameActions.ParsePath(sub, path, queue));
 }
Ejemplo n.º 11
0
 internal override void execute(Submarine sub, ActionsQueue queue)
 {
     queue.addAction(new SubmarinesGameLibrary.GameActions.LaunchTorpedo(sub, path, queue));
 }
Ejemplo n.º 12
0
 public Bang(Entity entity, ActionsQueue queue)
 {
     Entity       = entity;
     ActionsQueue = queue;
 }
Ejemplo n.º 13
0
 public ActivateMine(Entity mine, ActionsQueue queue)
 {
     Entity       = mine;
     ActionsQueue = queue;
 }
Ejemplo n.º 14
0
 public Accident(Submarine sub, Submarine sub1, ActionsQueue queue)
 {
     Entity       = sub;
     this.sub1    = sub1;
     ActionsQueue = queue;
 }
Ejemplo n.º 15
0
 public Bang(Entity entity, ActionsQueue queue)
 {
     Entity = entity;
     ActionsQueue = queue;
 }
Ejemplo n.º 16
0
 public TorpedoDamage(Submarine submarine, ActionsQueue queue)
 {
     Entity = submarine;
     ActionsQueue = queue;
 }
Ejemplo n.º 17
0
 public Accident(Submarine sub, Submarine sub1, ActionsQueue queue)
 {
     Entity = sub;
     this.sub1 = sub1;
     ActionsQueue = queue;
 }
Ejemplo n.º 18
0
 public MineDamage(Submarine submarine, ActionsQueue queue)
 {
     Entity       = submarine;
     ActionsQueue = queue;
 }
Ejemplo n.º 19
-1
 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);
 }