Beispiel #1
0
        public void SetNameAndLocal()
        {
            GameObject parent = new GameObject();

            SceneNodeView.SetName(parent, "parent");
            SceneNodeView.SetLocalX(parent, 10.0f);
            SceneNodeView.SetLocalY(parent, 20.0f);
            Assert.AreEqual("parent", SceneNodeView.GetName(parent));
            Assert.AreEqual(10.0f, SceneNodeView.GetLocalX(parent));
            Assert.AreEqual(20.0f, SceneNodeView.GetLocalY(parent));
            GameObject child = new GameObject();

            SceneNodeView.SetName(child, "child");
            SceneNodeView.SetLocalX(child, -4.0f);
            SceneNodeView.SetLocalY(child, 3.0f);
            SceneNodeView.AddChild(parent, child);
            Assert.AreEqual(-4.0f, SceneNodeView.GetLocalX(child));
            Assert.AreEqual(6.0f, SceneNodeView.GetWorldX(child));
            Assert.AreEqual(3.0f, SceneNodeView.GetLocalY(child));
            Assert.AreEqual(23.0f, SceneNodeView.GetWorldY(child));
            Vector3 position = new Vector3(5.0f, 1.5f);

            SceneNodeView.SetLocal(child, position);
            Assert.AreEqual(5.0f, SceneNodeView.GetLocalX(child));
            Assert.AreEqual(15.0f, SceneNodeView.GetWorldX(child));
            Assert.AreEqual(1.5f, SceneNodeView.GetLocalY(child));
            Assert.AreEqual(21.5f, SceneNodeView.GetWorldY(child));
            Object.DestroyImmediate(parent);
            Object.DestroyImmediate(child);
        }