Ejemplo n.º 1
0
        protected void timeBasedActionAddActionToManager(ITimeBasedAction actionToAdd)
        {
            if (timeBasedActionsManager == null)
                throw new NullReferenceException("timeBasedActionsManager");

            timeBasedActionsManager.AddAction(actionToAdd);
        }
Ejemplo n.º 2
0
        public void TimeBasedActionSetExecuted(ITimeBasedAction actionToExecute)
        {
            // Only one action can be executed at any time
            TimeBasedActionCancelExecuted();

            executedTimeBasedAction = actionToExecute;

            // Add action to manager (manager takes care of duplicated adds)
            timeBasedActionAddActionToManager(actionToExecute);
        }
Ejemplo n.º 3
0
        public void TimeBasedActionRemoveAffecting(ITimeBasedAction actionToRemove)
        {
            bool actionRemoved = affectingTimeBasedActions.Remove(actionToRemove);

            // Additional handling for attack action
            if (actionRemoved && (actionToRemove is AttackTimeBasedAction))
                attackersCount--;

            // Failsafe
            if (attackersCount < 0)
                throw new InvalidOperationException(
                    "Attacker count less than 0 for " + Name + "(" + EntityID + ")");
        }
Ejemplo n.º 4
0
 public void TimeBasedActionRemoveExecuted()
 {
     executedTimeBasedAction = null;
 }
Ejemplo n.º 5
0
        public void TimeBasedActionAddAffecting(ITimeBasedAction actionToAdd)
        {
            affectingTimeBasedActions.Add(actionToAdd);

            // Additional handling for attack action
            if (actionToAdd is AttackTimeBasedAction)
                attackersCount++;
        }