示例#1
0
        public void Loaddata()
        {
            Scene = gameScene.Scene;
            //если ты с горы упал - ты ешё не экстримал
            //чтоб далеко не падать
            groundplane = CreateGroundPlane();

            ///box
            {
                LevelObjectBox = LoadObject("WoodenCrate10WorldObject\0", null, true, true) as LevelObject;
                LevelObjectBox.matrialType = PivotObjectMaterialType.DynamicWood;
                LevelObjectBox.SetGlobalPose(Matrix.CreateRotationX(1.0f) * Matrix.CreateTranslation(0, 25, 0));
                AddObjectToScene(LevelObjectBox);
            }

            float delta = 4;
            int x = 5;
            int y = 5;

            for (int i = 0; i < x;i++ )
                for (int j = 0; j < y; j++)
                {
                    LevelObject lo = LoadObject("WoodenCrate10WorldObject\0", null, true, true) as LevelObject;
                    lo.matrialType = PivotObjectMaterialType.DynamicWood;
                    lo.SetGlobalPose(Matrix.CreateRotationX(1.0f) * Matrix.CreateTranslation(i * delta, 25, j * delta));
                    AddObjectToScene(lo);
                }

            ////test side
            {
                LevelObjectTestSide = LoadObject("TestSideWorldObject\0", null, true, true) as LevelObject;
                LevelObjectTestSide.SetGlobalPose(Matrix.CreateFromAxisAngle(new Vector3(1, 0, 0), -MathHelper.PiOver2) * Matrix.CreateTranslation(0, 15, 0));
                AddObjectToScene(LevelObjectTestSide);
            }

            ////palmbush1
            {
                LevelObject lo = LoadObject("lo_PalmBush1\0", null, false, false) as LevelObject;
                lo.SetGlobalPose(Matrix.CreateFromAxisAngle(new Vector3(1, 0, 0), -MathHelper.PiOver2) * Matrix.CreateTranslation(-5, 15.0f, 2));
                lo.CreateRenderSkew(0.03f);
                AddObjectToScene(lo);
            }

            ////palmbush2
            {
                LevelObject lo = LoadObject("lo_PalmBush2\0", null, false, false) as LevelObject;
                lo.SetGlobalPose(Matrix.CreateFromAxisAngle(new Vector3(1, 0, 0), -MathHelper.PiOver2) * Matrix.CreateTranslation(-5, 15.0f, 0));
                lo.CreateRenderSkew(0.03f);
                AddObjectToScene(lo);
            }
            ////grass1
            {

                LevelObject lo = LoadObject("lo_GrassBush1\0", null, false, false) as LevelObject;
                lo.SetGlobalPose(Matrix.CreateFromAxisAngle(new Vector3(1, 0, 0), -MathHelper.PiOver2) * Matrix.CreateTranslation(-6, 15.0f, -1));
                lo.CreateRenderSkew(0.1f);
                AddObjectToScene(lo);
            }
            ////particles
            {
                ParticleObject po = LoadParticleObject("Particle001RO\0", new Vector3(2));
                po.SetGlobalPose(Matrix.CreateFromAxisAngle(new Vector3(1, 0, 0), -MathHelper.PiOver2) * Matrix.CreateTranslation(2, 15, 2));
                po.SetParticlesParameters(10, Vector3.Up, 1.0f, -0.01f, 0.2f, 1.0f, 0.2f, 8000, 15);
                po.FirstEmition();
                gameScene.AddObject (po);
            }

            //чистим временные какахи
            //это стоит делать елси объекты больше не будут подгружаться
            //тоесть если игра по уровням скажем
               // packs.Unload();
        }
示例#2
0
        private void AddLevelObject(LevelObject loNew, Engine.Logic.PivotObject __parentObject = null)
        {
            if (loNew.renderaspect.isanimated)
            {
                Engine.Render.AnimRenderObject ro = loNew.renderaspect as Engine.Render.AnimRenderObject;
                Engine.AnimationManager.AnimationManager.Manager.AddAnimationUser(ro);
            }

            _scene.AddObject(loNew);

            if (__parentObject != null)
            {
                loNew.SetGlobalPose(Matrix.Identity, true, __parentObject);
                _scene._objects.AddRule(__parentObject, loNew);
            }
        }