示例#1
0
 public override MaybeNull <Act> CreateScript(Creature agent)
 {
     if (WrappedAct != null)
     {
         WrappedAct.Initialize();
     }
     return(WrappedAct);
 }
示例#2
0
        public static void RunTests()
        {
            Act       seq       = SimpleSequence();
            Act       select    = SimpleSelect();
            Act       par       = SimpleParallel();
            Act       forLoop   = SimpleFor();
            Act       whileLoop = SimpleWhile();
            Wait      wait      = new Wait(5.0f);
            Condition cond      = new Condition(() => { return(1 > 2 || 5 == 3 || 1 + 1 == 2); });

            Act complex    = ComplexBehavior();
            Act overloader = OverloaderTest();
            Act converter  = Convertor();

            seq.Initialize();
            foreach (Act.Status status in seq.Run())
            {
                Console.Out.WriteLine("Seq status: " + status.ToString());
            }

            select.Initialize();
            foreach (Act.Status status in select.Run())
            {
                Console.Out.WriteLine("select status: " + status.ToString());
            }

            par.Initialize();
            foreach (Act.Status status in par.Run())
            {
                Console.Out.WriteLine("par status: " + status.ToString());
            }

            forLoop.Initialize();
            foreach (Act.Status status in forLoop.Run())
            {
                Console.Out.WriteLine("for status: " + status.ToString());
            }

            whileLoop.Initialize();
            foreach (Act.Status status in whileLoop.Run())
            {
                Console.Out.WriteLine("while status: " + status.ToString());
            }

            cond.Initialize();

            foreach (Act.Status status in cond.Run())
            {
                Console.Out.WriteLine("cond status: " + status.ToString());
            }

            DateTime first = DateTime.Now;

            wait.Initialize();
            DwarfTime.LastTime = new DwarfTime(DateTime.Now - first, DateTime.Now - DateTime.Now);
            DateTime last = DateTime.Now;

            foreach (Act.Status status in wait.Run())
            {
                DwarfTime.LastTime = new DwarfTime(DateTime.Now - first, DateTime.Now - last);
                Console.Out.WriteLine("Wait status: " + status.ToString() + "," + wait.Time.CurrentTimeSeconds);
                last = DateTime.Now;
                System.Threading.Thread.Sleep(10);
            }

            complex.Initialize();
            foreach (Act.Status status in complex.Run())
            {
                DwarfTime.LastTime = new DwarfTime(DateTime.Now - first, DateTime.Now - last);
                Console.Out.WriteLine("Complex status: " + status.ToString());
                last = DateTime.Now;
                System.Threading.Thread.Sleep(10);
            }

            overloader.Initialize();
            foreach (Act.Status status in overloader.Run())
            {
                DwarfTime.LastTime = new DwarfTime(DateTime.Now - first, DateTime.Now - last);
                Console.Out.WriteLine("Overloader status: " + status.ToString());
                last = DateTime.Now;
                System.Threading.Thread.Sleep(10);
            }

            converter.Initialize();
            foreach (Act.Status status in converter.Run())
            {
                DwarfTime.LastTime = new DwarfTime(DateTime.Now - first, DateTime.Now - last);
                Console.Out.WriteLine("converter status: " + status.ToString());
                last = DateTime.Now;
                System.Threading.Thread.Sleep(10);
            }
        }
示例#3
0
 public override void Initialize()
 {
     SubAct.Initialize();
     base.Initialize();
 }