예제 #1
0
        /// <summary>
        /// Resumes execution of the associated AI and sets the decision maker state to
        /// <see cref="F:Crystal.DecisionMakerState.Running" />.
        /// </summary>
        public void Resume()
        {
            if (State != DecisionMakerState.Paused)
            {
                return;
            }

            State = DecisionMakerState.Running;
            OnResume();
        }
예제 #2
0
        /// <summary>
        /// Pauses the associated AI and the decision maker state to
        /// <see cref="F:Crystal.DecisionMakerState.Paused" />.
        /// </summary>
        public void Pause()
        {
            if (State != DecisionMakerState.Running)
            {
                return;
            }

            State = DecisionMakerState.Paused;
            OnPause();
        }
예제 #3
0
        /// <summary>
        /// Starts the associated AI and sets the decision maker state to
        /// <see cref="F:Crystal.DecisionMakerState.Running" />.
        /// </summary>
        public void Start()
        {
            if (State != DecisionMakerState.Stopped)
            {
                return;
            }

            State = DecisionMakerState.Running;
            OnStart();
        }
예제 #4
0
        /// <summary>
        /// Stops the associated AI and sets the decision maker state to
        /// <see cref="F:Crystal.DecisionMakerState.Stopped" />.
        /// </summary>
        public void Stop()
        {
            if (State == DecisionMakerState.Stopped)
            {
                return;
            }

            State = DecisionMakerState.Stopped;
            OnStop();
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DecisionMakerBase"/> class.
        /// </summary>
        /// <param name="ai">The ai.</param>
        /// <param name="contextProvider">The context provider.</param>
        /// <exception cref="Crystal.DecisionMakerBase.UtilityAiNullException"></exception>
        /// <exception cref="Crystal.DecisionMakerBase.ContextProviderNullException"></exception>
        protected DecisionMakerBase(IUtilityAi ai, IContextProvider contextProvider)
        {
            if (ai == null)
            {
                throw new UtilityAiNullException();
            }
            if (contextProvider == null)
            {
                throw new ContextProviderNullException();
            }

            _ai = ai;
            _contextProvider = contextProvider;
            State            = DecisionMakerState.Stopped;
        }