/// <summary>The method was already called in the stack.</summary> public void RecursiveCall(ICallInfo callInfo, ActionSet callerSet) { // Push object array. if (_builder.Controller.Attributes.RecursiveRequiresObjectStack) { actionSet.AddAction(_objectStore.ModifyVariable(Operation.AppendToArray, (Element)callerSet.CurrentObject)); } // Push new parameters. _builder.ParameterHandler.Push(callerSet, callInfo.Parameters.Select(p => p.Value).ToArray()); // Add to the continue skip array. var skipLength = new NumberElement(); actionSet.AddAction(_continueArray.ModifyVariable( Operation.AppendToArray, skipLength )); // Restart the method. SkipStartMarker resetSkip = new SkipStartMarker(actionSet); resetSkip.SetEndMarker(_endOfMethod); actionSet.AddAction(resetSkip); SkipEndMarker continueAtMarker = new SkipEndMarker(); actionSet.AddAction(continueAtMarker); skipLength.Value = _continueAt.NumberOfActionsToMarker(continueAtMarker); }
protected override void EndLoop() { // Break out of the while loop when the current node is the closest node to the player. PlayerNodeReachedBreak = new SkipStartMarker(actionSet, new V_Compare( GetClosestNode(actionSet, Nodes, Element.Part <V_PositionOf>(player)), Operators.NotEqual, current.GetVariable() )); actionSet.AddAction(PlayerNodeReachedBreak); }
public override void OnLoopEnd() { // Break out of the while loop when the current node is the closest node to the player. _playerNodeReachedBreak = new SkipStartMarker(ActionSet, Compare( NodeFromPosition(PositionOf(_player)), Operator.NotEqual, Builder.Current.GetVariable() )); ActionSet.AddAction(_playerNodeReachedBreak); }
public void StartRecursiveLoop() { // Create the recursive loop. actionSet.AddAction(Element.While(Element.True())); // Create the continue skip action. _continueAt = new SkipStartMarker(actionSet); _continueAt.SetSkipCount((Element)_nextContinue.GetVariable()); actionSet.AddAction(_continueAt); }