예제 #1
0
        /// <summary>
        /// Adds something to map settings.
        /// </summary>
        /// <remarks>
        /// Token in parameter must be Setup token.
        /// </remarks>
        /// <param name="commandToken">Token.</param>
        public void SetupMap(ISetupMapToken commandToken)
        {
            if (HasStarted)
            {
                throw new ArgumentException($"The game has already started, you cannot setup map.");
            }

            switch (commandToken.CommandTokenType)
            {
            case CommandTokenType.SetupSuperRegions:
                setupSuperRegionsToken = (SetupSuperRegionsToken)commandToken;
                break;

            case CommandTokenType.SetupRegions:
                setupRegionsToken = (SetupRegionsToken)commandToken;
                break;

            case CommandTokenType.SetupNeighbours:
                setupNeighboursToken = (SetupNeighboursToken)commandToken;
                break;

            case CommandTokenType.SetupWastelands:
                setupWastelandsToken = (SetupWastelandsToken)commandToken;
                break;

            default:
                throw new ArgumentException($"When calling {nameof(SetupMap)}, its argument {nameof(commandToken)} must be of Setup type.");
            }
        }
예제 #2
0
 private ICommandToken Execute(ISetupMapToken token)
 {
     mapController.SetupMap(token);
     return(null);
 }