示例#1
0
        public IEnumerator patrol()
        {
            Console.WriteLine(this.name + " patrol");

            yield return(CoRoutine.any(
                             checkNear(),
                             moveAround()
                             ));
        }
示例#2
0
        public IEnumerator startState()
        {
            Console.WriteLine(this.name + " startState");

            yield return(CoRoutine.any(
                             mainState(),
                             checkAlive()
                             ));

            //breaks out of main state if checkAlive stops;
            die();
        }
示例#3
0
        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)
                                 ));
            }
        }
示例#4
0
        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());

            }
        }
示例#5
0
 public void start()
 {
     CoRoutine.startCoroutine(run());
 }
 public static void startCoroutine(CoRoutine routine)
 {
     coroutines.Add(routine);
 }
示例#7
0
 public void startCoroutine(CoRoutine routine)
 {
     CoRoutine.startCoroutine(routine);
 }
示例#8
0
 public void startCoroutine(IEnumerator routine)
 {
     CoRoutine.startCoroutine(routine);
 }