示例#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;
        }