Ejemplo n.º 1
0
 public void Enter(Acting acting)
 {
     if (enterFunction != null)
     {
         enterFunction(acting);
     }
 }
Ejemplo n.º 2
0
 public void Exit(Acting e)
 {
     if (exitFunction != null)
     {
         exitFunction(e);
     }
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
0
 public SubstitutionContext(Acting acting, CompiledAction action)
 {
     this.acting        = acting;
     this.initialAction = action;
     this.currentAction = action;
 }