Ejemplo n.º 1
0
 private void UpdateSimulationState()
 {
     foreach (ADLSequence seq in this.simulationState.currentState.seqs)
     {
         int       currentSequenceIndex = this.simulationState.sequenceIndexes[seq.name];
         ADLAction action = seq.actions[currentSequenceIndex];
         if (action is SpannableAction)
         {
             if (((SpannableAction)action).IsEnd())
             {
                 this.simulationState.IncreaseSequenceIndex(seq);
                 if (action is ADLMoveAction)
                 {
                     this.velocity = new Vector2(0, 0);
                 }
             }
         }
         else if (action is ADLToStateAction)
         {
             action.PerformAction(this);
             break;
         }
         else if (action is ADLConditionAction)
         {
             ADLConditionAction condition = (ADLConditionAction)action;
             if (condition.PerformAction(this))
             {
                 this.simulationState.IncreaseSequenceIndex(seq);
             }
             else
             {
                 this.simulationState.IncreaseSequenceIndex(seq, condition.totalActions + 1);
             }
         }
         else
         {
             this.simulationState.IncreaseSequenceIndex(seq);
         }
     }
 }
Ejemplo n.º 2
0
    private void PerformAction()
    {
        foreach (ADLSequence seq in this.simulationState.currentState.seqs)
        {
            ADLAction action = (ADLAction)seq.actions[this.simulationState.sequenceIndexes[seq.name]];

            if (this.simulationState.elapsedTimes.ContainsKey(action))
            {
                this.simulationState.elapsedTimes[action] += Time.fixedDeltaTime;
            }
            else
            {
                this.simulationState.elapsedTimes.Add(action, Time.fixedDeltaTime);
                this.simulationState.singleQueryProperties.Add(action, new Dictionary <object, object>());
            }

            if (!(action is ADLToStateAction) && !(action is ADLConditionAction))
            {
                action.PerformAction(this);
            }
        }
    }