本文整理汇总了C#中Stage.WithSprite方法的典型用法代码示例。如果您正苦于以下问题:C# Stage.WithSprite方法的具体用法?C# Stage.WithSprite怎么用?C# Stage.WithSprite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stage
的用法示例。
在下文中一共展示了Stage.WithSprite方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareVM
private void PrepareVM(VM.VM vm, Stage.Stage stage)
{
vm.RegisterPrimitve("fd", delegate(object[] args)
{
stage.Fwd(kitsune, (double)args[0]);
return null;
});
vm.RegisterPrimitve("rt", delegate(object[] args)
{
stage.WithSprite(kitsune, (s) => s.rt((float)(double)args[0]));
return null;
});
vm.RegisterPrimitve("lt", delegate(object[] args)
{
stage.WithSprite(kitsune, (s) => s.lt((float)(double)args[0]));
return null;
});
vm.RegisterPrimitve("gotoxy", delegate(object[] args)
{
float x = (float) (double)args[0];
float y = (float)(double)args[1];
stage.WithSprite(kitsune, (s) => s.Move(new PointF(x,y)));
return null;
});
vm.RegisterPrimitve("random", delegate(object[] args)
{
int low = (int)(double)args[0];
int hi = (int)(double)args[1];
double r = random.Next(low, hi);
return r;
});
vm.RegisterPrimitve("+", delegate(object[] args)
{
double a = (double)args[0];
double b = (double)args[1];
return a+b;
});
vm.RegisterPrimitve("-", delegate(object[] args)
{
double a = (double)args[0];
double b = (double)args[1];
return a - b;
});
vm.RegisterPrimitve("*", delegate(object[] args)
{
double a = (double)args[0];
double b = (double)args[1];
return a * b;
});
vm.RegisterPrimitve("/", delegate(object[] args)
{
double a = (double)args[0];
double b = (double)args[1];
return a / b;
});
vm.RegisterPrimitve("<", delegate(object[] args)
{
object a = args[0];
object b = args[1];
if (a.GetType() != b.GetType())
{
a = a.ToString();
b = b.ToString();
}
return (a as IComparable).CompareTo(b)< 0;
});
vm.RegisterPrimitve("=", delegate(object[] args)
{
object a = args[0];
object b = args[1];
if (a.GetType() != b.GetType())
{
a = a.ToString();
b = b.ToString();
}
return a.Equals(b);
});
vm.RegisterPrimitve(">", delegate(object[] args)
{
object a = args[0];
object b = args[1];
if (a.GetType() != b.GetType())
{
a = a.ToString();
b = b.ToString();
}
return (a as IComparable).CompareTo(b) > 0;
});
//.........这里部分代码省略.........