コード例 #1
0
ファイル: CommandUntilLoop.cs プロジェクト: vosechu/KOS
        public override void Update(float time)
        {
            base.Update(time);

            if (ChildContext == null)
            {
                if (waitExpression.IsTrue())
                {
                    State = ExecutionState.DONE;
                }
                else
                {
                    ChildContext = targetCommand;
                    //ChildContext = Command.Get(commandstring, this);
                    ((ICommand)ChildContext).Evaluate();
                }
            }
            else
            {
                if (ChildContext != null && ChildContext.State == ExecutionState.DONE)
                {
                    ChildContext = null;
                }
            }
        }
コード例 #2
0
 public override void Update(float time)
 {
     if (triggered)
     {
         targetCommand.Update(time);
         if (targetCommand.State == ExecutionState.DONE)
         {
             ParentContext.Unlock(this);
         }
     }
     else if (expression.IsTrue())
     {
         triggered = true;
         targetCommand.Evaluate();
     }
 }
コード例 #3
0
 public override void Update(float time)
 {
     if (waitExpression != null)
     {
         if (waitExpression.IsTrue())
         {
             State = ExecutionState.DONE;
         }
     }
     else if (waitTime > 0)
     {
         waitTime -= time;
         if (waitTime <= 0)
         {
             State = ExecutionState.DONE;
         }
     }
 }
コード例 #4
0
ファイル: CommandIf.cs プロジェクト: jwvanderbeck/KOS_old
        public override void Evaluate()
        {
            expression = new Expression.Expression(RegexMatch.Groups[1].Value, ParentContext);

            var numLinesChild = Utils.NewLineCount(Input.Substring(0, RegexMatch.Groups[2].Index));
            targetCommand = Get(RegexMatch.Groups[2].Value, this, Line + numLinesChild);

            if (expression.IsTrue())
            {
                targetCommand.Evaluate();
                Push(targetCommand);
                State = ExecutionState.WAIT;
            }
            else
            {
                State = ExecutionState.DONE;
            }
        }
コード例 #5
0
        public override void Evaluate()
        {
            expression = new Expression.Expression(RegexMatch.Groups[1].Value, ParentContext);

            var numLinesChild = Utils.NewLineCount(Input.Substring(0, RegexMatch.Groups[2].Index));

            targetCommand = Get(RegexMatch.Groups[2].Value, this, Line + numLinesChild);

            if (expression.IsTrue())
            {
                targetCommand.Evaluate();
                Push(targetCommand);
                State = ExecutionState.WAIT;
            }
            else
            {
                State = ExecutionState.DONE;
            }
        }