コード例 #1
0
        /// <summary>
        /// Executes behavior with given context
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public override BehaviorReturnCode Behave(IBehaviorContext context)
        {
            UnitBehaviorContext unitContext = context as UnitBehaviorContext;

            if (unitContext == null)
            {
                returnCode = BehaviorReturnCode.Failure;
                return(returnCode);
            }

            ResourcesExtractor unit = unitContext.Unit as ResourcesExtractor;

            if (unit == null)
            {
                returnCode = BehaviorReturnCode.Failure;
                return(returnCode);
            }

            ExtractTask task = new ExtractTask(unit);

            task.Execute();
            returnCode = BehaviorReturnCode.Success;
            return(returnCode);
        }
コード例 #2
0
 /// <summary>
 /// Unregister an extract task with this station.
 /// </summary>
 /// <param name="task">The task that was done or cancelled for this station.</param>
 internal void UnregisterExtractTask(ExtractTask task)
 {
     _activeExtractTasks.Remove(task);
 }
コード例 #3
0
 /// <summary>
 /// Register an extract task with this station.
 /// </summary>
 /// <param name="task">The task that shall be done at this station.</param>
 internal void RegisterExtractTask(ExtractTask task)
 {
     _activeExtractTasks.Add(task);
 }