Пример #1
0
 public For(int start, int end, Func<int, Instruction> getBody)
 {
     this.i = start;
       this.start = start;
       this.end = end;
       this.getBody = getBody;
       this.body = getBody(i);
 }
Пример #2
0
 public override InstructionResult Execute(float dt)
 {
     switch (body.Execute(dt))
       {
     case InstructionResult.Done:
       body = body.Reset();
       return InstructionResult.Running;
     case InstructionResult.DoneAndCreateAsteroid:
       body = body.Reset();
       return InstructionResult.RunningAndCreateAsteroid;
     case InstructionResult.Running:
       return InstructionResult.Running;
     case InstructionResult.RunningAndCreateAsteroid:
       return InstructionResult.RunningAndCreateAsteroid;
       }
       return InstructionResult.Running;
 }
Пример #3
0
 public override InstructionResult Execute(float dt)
 {
     if (i >= end)
     return InstructionResult.Done;
       else
       {
     switch (body.Execute(dt))
     {
       case InstructionResult.Done:
     i++;
     body = getBody(i);
     return InstructionResult.Running;
       case InstructionResult.DoneAndCreateAsteroid:
     i++;
     body = getBody(i);
     return InstructionResult.RunningAndCreateAsteroid;
       case InstructionResult.Running:
     return InstructionResult.Running;
       case InstructionResult.RunningAndCreateAsteroid:
     return InstructionResult.RunningAndCreateAsteroid;
     }
     return InstructionResult.Done;
       }
 }
Пример #4
0
 public Repeat(Instruction body)
 {
     this.body = body;
 }
Пример #5
0
 public Semicolon(Instruction A, Instruction B)
 {
     this.A = A;
       this.B = B;
 }