public virtual void CallOnAddActionItemToQueue(RTSActionItem _actionItem)
 {
     if (OnAddActionItemToQueue != null)
     {
         OnAddActionItemToQueue(_actionItem);
     }
 }
 public AllyTacticsItem(int order,
                        IGBPI_DataHandler.IGBPI_Condition condition,
                        RTSActionItem action)
 {
     this.order     = order;
     this.condition = condition;
     this.action    = action;
 }
Example #3
0
 /// <summary>
 /// Performs Task If Preparation Is Complete.
 /// Boolean Indicates Task Preparation is Complete.
 /// </summary>
 /// <param name="_item"></param>
 /// <param name="_firstTime"></param>
 /// <returns></returns>
 protected virtual bool PerformTaskIfPrepared(RTSActionItem _item, bool _firstTime)
 {
     if (_item.preparationIsComplete(allyMember))
     {
         //Perform Task If....
         //First Time Performing Task Or
         //Task Is Not Finished Yet
         if (_firstTime)
         {
             _item.actionToPerform(allyMember);
         }
         else if (_item.taskIsFinished(allyMember) == false)
         {
             _item.actionToPerform(allyMember);
         }
         else
         {
             _item.stopPerformingTask(allyMember);
         }
         return(true);
     }
     return(false);
 }
Example #4
0
        protected virtual void OnAddActionItemToQueue(RTSActionItem _actionItem)
        {
            if (_actionItem == null)
            {
                return;
            }

            if (_actionItem.isCommandAction)
            {
                //Stops Previous Action Item If It Exists
                //and Isn't The Current Item
                if (PreviousCommandActionItem != null &&
                    PreviousCommandActionItem != _actionItem)
                {
                    PreviousCommandActionItem.stopPerformingTask(allyMember);
                }

                //Set Prev Action Item To Param If Current Is Null
                PreviousCommandActionItem = CommandActionItem == null ?
                                            _actionItem : CommandActionItem;

                //Sets Necessary Toggles and Handlers
                CommandActionItem     = _actionItem;
                bHasCommandActionItem = true;

                //This way AI Will Not Continue Operating
                //If a Player Command Is Issued
                CancelExecutionServices();
            }
            else
            {
                //Stops Previous Action Item If It Exists
                //and Isn't The Current Item
                if (PreviousAIActionItem != null &&
                    PreviousAIActionItem != _actionItem)
                {
                    PreviousAIActionItem.stopPerformingTask(allyMember);
                }

                //Set Prev Action Item To Param If Current Is Null
                PreviousAIActionItem = AIActionItem == null ?
                                       _actionItem : AIActionItem;

                //Sets Necessary Toggles and Handlers
                AIActionItem     = _actionItem;
                bHasAIActionItem = true;
            }

            //Only Toggle When Necessary
            if (_actionItem.requiresFullActionBar ||
                _actionItem.requiresActiveBarRegeneration)
            {
                myEventHandler.CallOnToggleActiveTimeRegeneration(true);
            }
            else
            {
                myEventHandler.CallOnToggleActiveTimeRegeneration(false);
            }

            //Start Invoking If Action Requires Full Bar
            //Or Multiple Executions Are Required
            if (_actionItem.requiresFullActionBar)
            {
                if (bIsInvokingWait == false)
                {
                    InvokeWaitingForActionBarToFill(true);
                }
            }
            else
            {
                if (bIsInvokingWait)
                {
                    InvokeWaitingForActionBarToFill(false);
                }

                PerformTaskIfPrepared(_actionItem, true);
            }

            if (_actionItem.executeMultipleTimes)
            {
                if (bIsInvokingMultExecutions == false)
                {
                    InvokeUpdateMultipleExecuteAction(true);
                }
            }
            else
            {
                if (bIsInvokingMultExecutions)
                {
                    InvokeUpdateMultipleExecuteAction(false);
                }
            }
        }