本文整理汇总了C#中World.Attach方法的典型用法代码示例。如果您正苦于以下问题:C# World.Attach方法的具体用法?C# World.Attach怎么用?C# World.Attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类World
的用法示例。
在下文中一共展示了World.Attach方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public static World Create(int width, int height, string texName)
{
var cmp = new MyWorld ();
var spr = new Sprite (width, height);
spr.AddTexture (new Texture (texName));
var wld = new World ();
wld.Attach (cmp);
wld.Attach (spr);
return wld;
}
示例2: Test_Animate
public void Test_Animate()
{
var wld = new World ();
var nod = new Node ();
wld.AddChild (nod);
var cmp1 = new MyComponent ();
var cmp2 = new MyComponent ();
wld.Attach (cmp1);
nod.Attach (cmp2);
wld.Animate (0, 0);
Assert.AreEqual (1, cmp1.Animated);
Assert.AreEqual (1, cmp2.Animated);
nod.Animatable = false;
wld.Animate (0, 0);
Assert.AreEqual (2, cmp1.Animated);
Assert.AreEqual (1, cmp2.Animated);
}
示例3: Test_UpdateInit
public void Test_UpdateInit()
{
var wld = new World ();
var nod = new Node ();
wld.AddChild (nod);
var cmp1 = new MyComponent ();
var cmp2 = new MyComponent ();
wld.Attach (cmp1);
nod.Attach (cmp2);
wld.Update (0);
Assert.AreEqual (1, cmp1.OnUpdateInited);
Assert.AreEqual (1, cmp2.OnUpdateInited);
wld.Update (0);
Assert.AreEqual (1, cmp1.OnUpdateInited);
Assert.AreEqual (1, cmp2.OnUpdateInited);
}