public override void UpdateObjectProperties(object Input, PropertyGrid Properties, ListView Scene)
        {
            XTreeSystem treeSystem = (XTreeSystem)Input;

            if (!string.IsNullOrEmpty(treeSystem.TreeMapFile) && treeSystem.HeightMap != null)
            {
                try
                {
                    treeSystem.Load(X.Content);
                    treeSystem.GenerateTrees(X.DefaultCamera);
                }
                catch
                {
                    MessageBox.Show("There was a problem loading one of the TreeSystem's files.", "File Error");
                }
            }

            base.UpdateObjectProperties(Input, Properties, Scene);
        }
Beispiel #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            //Load engine base content
            X.LoadContent();

            //Game base elements
            menus.Load(Content);


            // load scene objects/content
            //sky = new XDynamicSky(ref X,X.Environment);
            //XSkyBox sky = new XSkyBox(ref X, @"Content\XEngine\Textures\Sky\front", @"Content\XEngine\Textures\Sky\back", @"Content\XEngine\Textures\Sky\left", @"Content\XEngine\Textures\Sky\right", @"Content\XEngine\Textures\Sky\top", @"Content\XEngine\Textures\Sky\bottom");
            XSkyBox sky = new XSkyBox(ref X, @"Content\XEngine\Textures\Sky\GreenWaterSky");

            heightmap = new XHeightMap(ref X, @"Content\Images\Heightmaps\Level2", X.Environment, @"Content\Textures\Grass", @"Content\Textures\Sand", null, @"Content\Images\Terrainmaps\Island1");

            //resources.AddComponent(environment);
            resources.AddComponent(heightmap);
            resources.AddComponent(sky);

            model = new XModel(ref X, @"Content\Models\cube");
            resources.AddComponent(model);

            Chassis = new XModel(ref X, @"Content\Models\chassis");
            Wheel   = new XModel(ref X, @"Content\Models\wheel");

            resources.AddComponent(Chassis);
            resources.AddComponent(Wheel);

            housemodel = new XModel(ref X, @"Content\Models\spider");
            resources.AddComponent(housemodel);

            resources.Load();

            //Car = new XCar(ref X, Chassis, Wheel, true, true, 30.0f, 5.0f, 4.7f, 5.0f, 0.20f, 0.4f, 0.05f, 0.45f, 0.3f, 1, 520.0f, Math.Abs(X.Gravity.Y), new Vector3(-10, heightmap.Heights.GetHeight(new Vector3(-10, 3, 0))+5, 0));

            Car = new XCar(ref X, Chassis, Wheel,
                           true,                       // front wheel drive
                           true,                       // rear wheel drive
                           35.0f,                      // max steering angle
                           5f,                         // steering rate
                           3.6f,                       // front lateral traction
                           3.1f,                       // rear lateral traction
                           1f,                         // front longintudinal traction
                           2f,                         // rear longitudinal traction
                           2.5f,                       // handbrake rear lateral traction
                           .75f,                       // handbrake rear longitudinal traction
                           6f,                         // starting slide factor
                           15f,                        // threshold 1 slide factor
                           30f,                        // threshold 2 slide factor
                           .7f,                        // slip threshold 1
                           10.0f,                      // slip threshold 2
                           2.0f,                       // slide speed factor
                           1.7f,                       // traction loss factor on slip
                           0.3f,                       // suspension travel
                           0.45f,                      // wheel radius
                           -0.10f,                     // wheel mounting point
                           0.6f,                       // spring rate
                           0.6f,                       // shock dampening
                           2,                          // wheel rays
                           2.5f,                       // roll resistance
                           300.0f,                     // top speed
                           1200.0f,                    // torque
                           X.Physics.Gravity.Length(), // gravity
                           new Vector3(-10, heightmap.Heights.GetHeight(new Vector3(-10, 3, 0)) + 5, 0)
                           );

            Car.Load(X.Content);

            trees = new XTreeSystem(ref X, @"Content\Images\Treemaps\Level1", heightmap);
            trees.Load(Content);
            trees.GenerateTrees(freeCamera);

            input.Load();
            base.LoadContent();
        }