Пример #1
0
        public override void Load()
        {
            base.Load();

            // Set up the reference grid and sample camera
            grid.LoadGraphicsContent(graphicsDevice);

            Sky = new SkySphere(content, graphicsDevice, content.Load<TextureCube>("Textures\\SkyBox\\space4"), 100);// set 11 for debug

            // Load stars
            star = new Star(new Vector3(-500, 100, 500), graphicsDevice, content, StarType.G);
            //star = new Star(-LightPosition, device, content, StarType.G);
            LightPosition = star.Position;
            //sun = new Sun(new Vector3(-500, 100, 500), graphicsDevice, content, spriteBatch);
            sun = new Sun(new Vector3(-2000, 500, 2000), graphicsDevice, content, spriteBatch);
            sunCircle = new Sun(LightPosition, graphicsDevice, content, spriteBatch);

            // Load planets
            Planets = new List<Planet>();
            TargetPlanets = new List<DamageablePlanet>();
            //WaterPlanet waterPlanet = new WaterPlanet(new Vector3(-1000, 0, -1000), -LightPosition, device, content);
            WaterPlanet waterPlanet = new WaterPlanet(new Vector3(-100, 100, -100), LightPosition, graphicsDevice, content);
            IcePlanet icePlanet = new IcePlanet(new Vector3(-100, 100, -800), LightPosition, graphicsDevice, content);
            GasGiant gasGiant = new GasGiant(new Vector3(-100, 100, -2500), LightPosition, graphicsDevice, content);
            RockPlanet rockPlanet = new RockPlanet(graphicsDevice, content);
            MoltenPlanet moltenPlanet = new MoltenPlanet(graphicsDevice, content);

            //planet = moltenPlanet;
            //planet = gasGiant;
            //planet = icePlanet;
            planet = waterPlanet;
            //Planets.Add(waterPlanet);
            TargetPlanets.Add(waterPlanet);
            Planets.Add(icePlanet);
            Planets.Add(gasGiant);

            // Load asteroids
            random = new Random();
            Asteroids = new List<Asteroid>();
            AddAsteroids(5, 2000);
            /*foreach (Asteroid o in Asteroids) {
                Models.Add(o);
            }*/
            foreach (Object o in Asteroids) {
                Enemies.Add(o);
            }
            spawned = true;

            // Load satellites
            //Satellite = new ArmedSatellite(new Vector3(300, 50, 300), star.Position, 5, "Models\\ISS", "SoundEffects\\laser1");
            Satellite = new ArmedSatellite(new Vector3(300, 50, 300), sun.Position, 5, "Models\\ISS", "SoundEffects\\laser0");
            Models.Add(Satellite);
            //Models.Add(new Satellite(false, waterPlanet.Position + new Vector3(400, 100, 600), waterPlanet.Position, 100f, "Models\\spacestation4"));
            Models.Add(new SpaceStation(false, waterPlanet.Position + new Vector3(400, 100, 600), waterPlanet.Position, 100f, "Models\\spacestation4"));

            //Models.Add(new ArmedSatellite(waterPlanet.Position + new Vector3(400, 50, 0), waterPlanet.Position, 0.01f, "Models\\TDRS", "SoundEffects\\License\\LAAT0"));
            Models.Add(new ArmedSatellite(SatelliteWeapon.Missile, waterPlanet.Position + new Vector3(400, 50, 0), waterPlanet.Position, 10f, "Models\\Dawn", "SoundEffects\\missile0"));// deepspace,10 / rosetta,10

            //Models.Add(new ArmedSatellite(waterPlanet.Position + new Vector3(400, 50, 0), waterPlanet.Position, 0.01f, "Models\\TDRS", "SoundEffects\\laser0"));

            // Load fighters
            //Models.Add(new Fighter(new Vector3(2000, 50, 1000), waterPlanet.Position, 20f, "Models\\fighter0"));
            //Enemies.Add(Models[Models.Count - 1]);
            Fighters = new List<Fighter>();
            Fighters.Add(new Fighter(new Vector3(2000, 50, 1000), waterPlanet.Position, 20f, "Models\\fighter0"));
            Fighters.Add(new Fighter(new Vector3(100, 1000, 100), waterPlanet.Position, 20f, "Models\\fighter0"));
            Fighters.Add(new Fighter(new Vector3(-100, -1000, -100), waterPlanet.Position, 20f, "Models\\fighter0"));
            Fighters.Add(new Fighter(new Vector3(-2000, 50, -1000), waterPlanet.Position, 20f, "Models\\fighter0"));
            foreach (Fighter f in Fighters) {
                Enemies.Add(f);
            }
            foreach (Object o in Enemies) {
                Models.Add(o);
            }

            // Set up light effects !!
            shadowEffect = content.Load<Effect>("ProjectShadowDepthEffectV4");
            Effect lightingEffect = content.Load<Effect>("PPModel");	// load Prelighting Effect
            foreach (Object o in Models) {
                o.RenderBoudingSphere = false;
                if (!(o is Asteroid)) {
                    o.SetModelEffect(shadowEffect, true);
                }
            }
            foreach (Planet p in Planets) {
                p.RenderBoudingSphere = false;
                //p.SetModelEffect(shadowEffect, true);
                Models.Add(p);
            }
            foreach (DamageablePlanet p in TargetPlanets) {
                p.RenderBoudingSphere = false;
                //p.SetModelEffect(shadowEffect, true);
                Models.Add(p);
            }

            renderer = new PrelightingRenderer(graphicsDevice, content);
            renderer.Models = Models;
            renderer.Camera = camera;
            renderer.Lights = new List<PointLight>() {
                //new PointLightCircle(new Vector3(0, 1000, 0), 2000, Color.White, 2000),	// 影のデバッグ用
                //new PointLight(new Vector3(0, 500, 0), Color.White, 2000),				// 太陽の光源
                new PointLight(sun.Position, Color.White, 5000),							// 太陽の光源
                new PointLight(new Vector3(0, 10000, 0), Color.White * .85f, 100000),		// シーン全体を照らす巨大なライトにする
            };
            renderer.ShadowLightPosition = new Vector3(300, 500, 300);//LightPosition;
            renderer.ShadowLightTarget = new Vector3(0, 0, 0);
            renderer.DoShadowMapping = true;
            renderer.ShadowMult = 0.3f;//0.01f;//0.3f;
            LightPosition = renderer.Lights[0].Position;

            // Special effects
            EnergyRingEffect.game = game;
            discoidEffect = new EnergyRingEffect(content, graphicsDevice, new Vector3(0, 0, 0), new Vector2(300));
            EnergyShieldEffect.game = game;
            shieldEffect = new EnergyShieldEffect(content, graphicsDevice, Satellite.Position, new Vector2(300), 250);
            explosionTest = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, true, "Xml\\Particle\\particleExplosion0.xml", true);
            smallExplosion = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion0.xml", false);
            //smallExplosion = new ExplosionEffect(content, device, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion0.xml", true);
            bigExplosion = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion1.xml", false);
            midExplosion = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion2.xml", false);

            lb = new LaserBillboard(graphicsDevice, content, content.Load<Texture2D>("Textures\\Laser2"), new Vector2(300, 50), new Vector3(0, 50, 0), new Vector3(100, 60, -100));
        }
Пример #2
0
        public override void Load()
        {
            base.Load();

            // Set up the reference grid and sample camera
            grid.LoadGraphicsContent(graphicsDevice);

            Sky = new SkySphere(content, graphicsDevice, content.Load<TextureCube>("Textures\\SkyBox\\space4"), 100);// set 11 for debug

            // Load stars
            star = new Star(new Vector3(-500, 100, 500), graphicsDevice, content, StarType.G);
            //star = new Star(-LightPosition, device, content, StarType.G);
            LightPosition = star.Position;
            sun = new Sun(new Vector3(-500, 100, 500), graphicsDevice, content, spriteBatch);
            sunCircle = new Sun(LightPosition, graphicsDevice, content, spriteBatch);

            // Load planets
            Planets = new List<Planet>();
            //WaterPlanet waterPlanet = new WaterPlanet(new Vector3(-1000, 0, -1000), -LightPosition, device, content);
            WaterPlanet waterPlanet = new WaterPlanet(new Vector3(-100, 100, -100), LightPosition, graphicsDevice, content);
            IcePlanet icePlanet = new IcePlanet(new Vector3(-100, 100, -800), LightPosition, graphicsDevice, content);
            GasGiant gasGiant = new GasGiant(new Vector3(-100, 100, -2500), LightPosition, graphicsDevice, content);
            RockPlanet rockPlanet = new RockPlanet(graphicsDevice, content);
            MoltenPlanet moltenPlanet = new MoltenPlanet(graphicsDevice, content);

            //planet = moltenPlanet;
            //planet = gasGiant;
            //planet = icePlanet;
            planet = waterPlanet;
            Planets.Add(waterPlanet);
            Planets.Add(icePlanet);
            Planets.Add(gasGiant);

            // Asteroids
            random = new Random();
            Asteroids = new List<Asteroid>();
            AddAsteroids(5, 2000);
            foreach (Object o in Asteroids) {
                Models.Add(o);
            }
            spawned = true;

            // Load satellites
            //Satellite = new ArmedSatellite(new Vector3(300, 50, 300), star.Position, 5, "Models\\ISS", "SoundEffects\\laser1");
            Satellite = new ArmedSatellite(new Vector3(300, 50, 300), star.Position, 5, "Models\\ISS", "SoundEffects\\laser0");
            Models.Add(Satellite);
            Models.Add(new ArmedSatellite(waterPlanet.Position + new Vector3(400, 50, 0), waterPlanet.Position, 0.01f, "Models\\TDRS", "SoundEffects\\License\\LAAT0"));
            //Models.Add(new ArmedSatellite(waterPlanet.Position + new Vector3(400, 50, 0), waterPlanet.Position, 0.01f, "Models\\TDRS", "SoundEffects\\laser0"));

            // Set up light effects !!
            shadowEffect = content.Load<Effect>("ProjectShadowDepthEffectV4");
            Effect lightingEffect = content.Load<Effect>("PPModel");	// load Prelighting Effect
            foreach (Object o in Models) {
                if (o is Satellite) {
                    string d = "";
                }
                o.RenderBoudingSphere = false;
                o.SetModelEffect(shadowEffect, true);
            }
            foreach (Planet p in Planets) {
                p.RenderBoudingSphere = false;
                //p.SetModelEffect(shadowEffect, true);
                Models.Add(p);
            }

            renderer = new PrelightingRenderer(graphicsDevice, content);
            renderer.Models = Models;
            renderer.Camera = camera;
            renderer.Lights = new List<PointLight>() {
                new PointLightCircle(new Vector3(0, 1000, 0), 2000, Color.White, 2000),
                new PointLight(new Vector3(0, 500, 0), Color.LightBlue, 2000),
                new PointLight(new Vector3(0, 10000, 0), Color.White * .85f, 100000),// シーン全体を照らす巨大なライトにする
                //new PointLightCircle(new Vector3(0, 200, 0), 200, Color.White, 2000),
                //new PointLight(LightPosition, Color.White * .85f, 2000000),
                //new PointLight(new Vector3(0, 200, 0), Color.White * .85f, 100000),
            };
            renderer.ShadowLightPosition = new Vector3(300, 500, 300);//LightPosition;
            renderer.ShadowLightTarget = new Vector3(0, 0, 0);
            renderer.DoShadowMapping = true;
            renderer.ShadowMult = 0.3f;//0.01f;//0.3f;
            LightPosition = renderer.Lights[0].Position;

            // Special effects
            EnergyRingEffect.game = game;
            discoidEffect = new EnergyRingEffect(content, graphicsDevice, new Vector3(0, 0, 0), new Vector2(300));
            EnergyShieldEffect.game = game;
            shieldEffect = new EnergyShieldEffect(content, graphicsDevice, Satellite.Position, new Vector2(300), 250);
            explosionTest = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, true, "Xml\\Particle\\particleExplosion0.xml", true);
            smallExplosion = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion0.xml", false);
            //smallExplosion = new ExplosionEffect(content, device, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion0.xml", true);
            bigExplosion = new ExplosionEffect(content, graphicsDevice, new Vector3(0, 50, 0), Vector2.One, false, "Xml\\Particle\\particleExplosion1.xml", false);

            // pre-load
            //setting = new ParticleSettings("Xml\\Particle\\particleExplosion0");

            lb = new LaserBillboard(graphicsDevice, content, content.Load<Texture2D>("Textures\\Laser2"), new Vector2(300, 50), new Vector3(0, 50, 0), new Vector3(100, 60, -100));
        }