Exemple #1
0
 public AddStackCommand(TurnCounter counter, List <Unit> units, BattleArmy armyFirst, BattleArmy armySecond)
 {
     this.counter    = counter;
     this.units      = units;
     this.armyFirst  = armyFirst;
     this.armySecond = armySecond;
 }
Exemple #2
0
 public void Escape()
 {
     state = BattleState.FINISHED;
     if (currentArmy.Equals(Second))
     {
         winner = First;
     }
     else
     {
         winner = Second;
     }
 }
Exemple #3
0
 private void onMove()
 {
     if (currentArmy == null || currentArmy == Second)
     {
         currentArmy = First;
     }
     else
     {
         currentArmy = Second;
     }
     Queue        = new BattleQueue(currentArmy.Stacks);
     CurrentStack = Queue?.First();
 }
Exemple #4
0
        public Menu(IEnumerable <Unit> units)
        {
            ArmyFirst  = new BattleArmy();
            ArmySecond = new BattleArmy();
            Units      = units.ToList();

            game    = new Battle(ArmyFirst, ArmySecond);
            counter = new TurnCounter();
            fsm     = new FiniteStateMachine();

            // General commands
            AddCommand("help", new HelpCommand(commands));
            AddCommand("list", new ListUnitsCommand(Units));
            AddCommand("army", new ListArmyCommand(counter, ArmyFirst, ArmySecond));

            // Preparation commands
            AddStatefulCommand("add", new AddStackCommand(counter, Units, ArmyFirst, ArmySecond), new[] {
Exemple #5
0
 public Battle(BattleArmy firstArmy, BattleArmy secondArmy)
 {
     First  = firstArmy;
     Second = secondArmy;
     state  = BattleState.STOPPED;
 }
Exemple #6
0
 public ListArmyCommand(TurnCounter counter, BattleArmy armyFirst, BattleArmy armySecond)
 {
     this.counter    = counter;
     this.armyFirst  = armyFirst;
     this.armySecond = armySecond;
 }