当前位置: 首页>>代码示例>>C#>>正文


C# Condition.Initialize方法代码示例

本文整理汇总了C#中Condition.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Condition.Initialize方法的具体用法?C# Condition.Initialize怎么用?C# Condition.Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Condition的用法示例。


在下文中一共展示了Condition.Initialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RunTests

        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);
            }
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:90,代码来源:TestBehaviors.cs


注:本文中的Condition.Initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。