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); }
public override IResult Execute(float dt) { switch (body.Execute(dt)) { case IResult.Done: body = body.Reset(); return IResult.Running; case IResult.DoneAndCreate: body = body.Reset(); return IResult.RunningAndCreate; case IResult.Running: return IResult.Running; case IResult.RunningAndCreate: return IResult.RunningAndCreate; } return IResult.Running; }
public override IResult Execute(float dt) { if (i >= end) return IResult.Done; else { switch (body.Execute(dt)) { case IResult.Done: i++; body = getBody(i); return IResult.Running; case IResult.DoneAndCreate: i++; body = getBody(i); return IResult.RunningAndCreate; case IResult.Running: return IResult.Running; case IResult.RunningAndCreate: return IResult.RunningAndCreate; } return IResult.Done; } }
public Repeat(Instruction body) { this.body = body; }
public Next(Instruction One, Instruction Two) { this.One = One; this.Two = Two; }