/// <summary>
 /// Produces an army with the given composition and a corresponding sprite by the given cellTypeId.
 /// </summary>
 private void InitializeCellById(byte cellTypeId, ArmyComposition armyComposition,
                                 out Army army, out Sprite sprite)
 {
     army   = null;
     sprite = null;
     if (cellTypeId == firstPlayerCellId)
     {
         army   = new UserArmy(PlayerType.FIRST, armyComposition);
         sprite = firstUserSprite;
     }
     else if (cellTypeId == secondPlayerCellId)
     {
         army   = new UserArmy(PlayerType.SECOND, armyComposition);
         sprite = secondUserSprite;
     }
     else if (cellTypeId == neutralFriendlyCellId)
     {
         army   = new NeutralFriendlyArmy(armyComposition);
         sprite = neutralFriendlySprite;
     }
     else if (cellTypeId == neutralAggressiveCellId)
     {
         army   = new NeutralAggressiveArmy(armyComposition);
         sprite = neutralAggressiveSprite;
     }
 }
Beispiel #2
0
        private Color GetUserArmyFrameColor(UserArmy userArmy)
        {
            Color color;

            //It is user army.
            if (userArmy.PlayerType == turnManager.GetCurrentPlayerType())
            {
                //It is our army.
                if (userArmy.IsActive())
                {
                    //We can move this army
                    color = playerActiveArmyFrameColor;
                }
                else
                {
                    //We cannot move this army
                    color = playerInactiveArmyFrameColor;
                }
            }
            else
            {
                //It is opponents' army.
                color = enemyArmyFrameColor;
            }

            return(color);
        }
 /// <summary>
 /// Generates an army for player and produces the corresponding sprite by the given player type.
 /// </summary>
 private void InitializePlayerArmyCell(PlayerType playerType, out Army army, out Sprite sprite)
 {
     sprite = null;
     army   = new UserArmy(playerType, GenerateArmyComposition(randomNumberOfUnitsFrom, randomNumberOfUnitsTo));
     if (playerType == PlayerType.FIRST)
     {
         sprite = firstUserSprite;
     }
     else if (playerType == PlayerType.SECOND)
     {
         sprite = secondUserSprite;
     }
 }