本文整理汇总了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);
}
}