Exemple #1
0
            public void Initialize()
            {
                parent        = new SpinObject();
                child         = new SpinObject();
                childNotAdded = new SpinObject();

                var texture = Engine.Graphics.CreateTexture2D(CloudTexturePath);

                parent.Texture        = texture;
                parent.CenterPosition = texture.Size.To2DF() / 2;
                parent.Scale          = new Vector2DF(0.5f, 0.5f);
                parent.Position       = position;

                child.Texture        = texture;
                child.CenterPosition = texture.Size.To2DF() / 2;
                child.Scale          = new Vector2DF(0.5f, 0.5f);
                child.Position       = position + new Vector2DF(0, 100);

                childNotAdded.Texture        = texture;
                childNotAdded.CenterPosition = texture.Size.To2DF() / 2;
                childNotAdded.Scale          = new Vector2DF(0.5f, 0.5f);
                childNotAdded.Position       = position + new Vector2DF(0, 200);

                parent.AddChild(child, mode, ChildTransformingMode.Nothing);
                parent.AddChild(childNotAdded, mode, ChildTransformingMode.Nothing);

                Engine.AddObject2D(parent);
                if ((mode & ChildManagementMode.RegistrationToLayer) == 0)
                {
                    Engine.AddObject2D(child);
                }

                Assert.AreNotEqual(null, child.Parent);
                Assert.AreNotEqual(null, child.Parent.Layer);
            }