コード例 #1
0
 /// <summary>
 /// Called when a player initiates a battle from the Economy state.
 /// </summary>
 /// <param name="attackingArmy">The army that attacked.</param>
 /// <param name="defendingArmy">The army that was attacked.</param>
 public void OnInitiateBattle(Army attackingArmy, Army defendingArmy, Tile attackingTile, Tile defendingTile)
 {
     players.Clear();
     players.Add(defendingArmy.Owner);
     players.Add(attackingArmy.Owner);
     battleGrid.InitField();
     battleGrid.BattleGenerate(attackingTile.Terrain, attackingTile.hills, defendingTile.Terrain, defendingTile.hills, battleGrid.Width, battleGrid.Height, attackingArmy.Owner, defendingArmy.Owner);
     battleGrid.PopulateField(attackingArmy, defendingArmy);
     battleGrid.defendingTile = defendingTile;
     battleGrid.attackingTile = attackingTile;
     attackingArmy.Owner.BattleCameraPosition = Vector2.Zero;
     defendingArmy.Owner.BattleCameraPosition = Vector2.Zero;
     currentPlayer = players.IndexOf(defendingArmy.Owner);
 }
コード例 #2
0
        public BattleState(Player blue, Player red)
        {
            // Initialize players
            players = new List <Player>();
            players.Add(blue);
            players.Add(red);
            currentPlayer = 0;

            // Initialize the battlefield.
            battleGrid = new BattleGrid(35, 35, players);
            battleGrid.InitField();

            // Initialize the overlay.
            ResetOverlay();

            // Reset ourselves
            //Reset();
        }