public IEnumerator patrol() { Console.WriteLine(this.name + " patrol"); yield return(CoRoutine.any( checkNear(), moveAround() )); }
public IEnumerator startState() { Console.WriteLine(this.name + " startState"); yield return(CoRoutine.any( mainState(), checkAlive() )); //breaks out of main state if checkAlive stops; die(); }
public IEnumerator moveAround() { var ran = new Random(); while (true) { Console.WriteLine(this.name + " move around"); var point = new Position(ran.Next(100), ran.Next(100)); yield return(CoRoutine.all( moveX(point.x), moveY(point.y) )); } }
public static IEnumerator testStart() { while (true) { Console.WriteLine("\n\nstarting multi routine -- ANY"); yield return CoRoutine.any(doTimedThingShort(),doThing()); Console.WriteLine("\n\nstarting multi routine -- ALL"); yield return CoRoutine.all(doThing(),doTimedThingShort()); Console.WriteLine("\n\nstarting multi routine -- ANY RANDOMS"); yield return CoRoutine.any(doTimedThingRandom(),doTimedThingRandom(),doTimedThingRandom()); Console.WriteLine("\n\nstarting multi routine -- ALL RANDOMS"); yield return CoRoutine.all(doTimedThingRandom(),doTimedThingRandom(),doTimedThingRandom(),doTimedThingRandom()); } }
public void start() { CoRoutine.startCoroutine(run()); }
public static void startCoroutine(CoRoutine routine) { coroutines.Add(routine); }
public void startCoroutine(CoRoutine routine) { CoRoutine.startCoroutine(routine); }
public void startCoroutine(IEnumerator routine) { CoRoutine.startCoroutine(routine); }