Example #1
0
 public void Enter(Acting acting)
 {
     if (enterFunction != null)
     {
         enterFunction(acting);
     }
 }
Example #2
0
 public void Exit(Acting e)
 {
     if (exitFunction != null)
     {
         exitFunction(e);
     }
 }
Example #3
0
        public void TickAction(Acting acting)
        {
            currentRepeatCount++;
            Step currentStep = m_steps[currentStepIndex];

            if (!currentStep.IsRepeatLimitMet(currentRepeatCount))
            {
                return;
            }

            int relativeIndex = currentStep.CheckSuccessAndGetRelativeIndex(acting);

            if (relativeIndex != 0)
            {
                currentStepIndex  += relativeIndex + m_steps.Length;
                currentStepIndex  %= m_steps.Length;
                currentRepeatCount = 0;
                currentStep.Exit(acting);
                m_steps[currentStepIndex].Enter(acting);
            }
        }
Example #4
0
        public int CheckSuccessAndGetRelativeIndex(Acting acting)
        {
            if (successFunction != null)
            {
                var result = successFunction(acting);
                if (result.index != null)
                {
                    return((int)result.index);
                }
                if (result.success)
                {
                    return(relativeStepIndexSuccess);
                }
                return(relativeStepIndexFail);
            }

            if (acting._flags.HasFlag(ActingState.ActionSucceeded))
            {
                return(relativeStepIndexSuccess);
            }
            return(relativeStepIndexFail);
        }
Example #5
0
 public SubstitutionContext(Acting acting, CompiledAction action)
 {
     this.acting        = acting;
     this.initialAction = action;
     this.currentAction = action;
 }