Exemplo n.º 1
0
        public void Apply_Action(
            Random randomness_provider,
            PD_Action playerAction
            )
        {
            CurrentAvailableMacros = new List <PD_MacroAction>();

            if (CurrentAvailablePlayerActions.Contains(playerAction) == false)
            {
                throw new System.Exception("non applicable action");
            }

            PlayerActionsHistory.Add(playerAction);

            game_FSM.OnCommand(randomness_provider, this, playerAction);

            UpdateAvailablePlayerActions();

            // after an action is applied, see if the next action is auto action
            // and if so, apply it automatically.
            if (
                CurrentAvailablePlayerActions != null &&
                CurrentAvailablePlayerActions.Count > 0
                )
            {
                if (CurrentAvailablePlayerActions[0] is I_Auto_Action)
                {
                    Apply_Action(
                        randomness_provider,
                        CurrentAvailablePlayerActions[0]
                        );
                }
            }
        }