コード例 #1
0
ファイル: MyScene.cs プロジェクト: WaveEngine/Samples
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            this.CreateLayers();

            // Add asteroidfield
            var asteroidField = new AsteroidFieldDecorator("asteroidField", new Vector3(2000, 2000, 0));
            this.EntityManager.Add(asteroidField);
            WaveServices.SoundPlayer.GetSceneSoundBank(this).MaxConcurrentSounds = 30;
        }
コード例 #2
0
ファイル: MyScene.cs プロジェクト: seraph526/Samples
        /// <summary>
        /// Create scene environment:
        /// - Projectiles, Explosions
        /// - Asteroid field,
        /// - Starfield
        /// </summary>
        private void CreateEnvironment()
        {
            // Projectiles
            Entity blueProjectiles = new Entity("Projectiles")
                .AddComponent(new ProjectileManager())
                .AddComponent(new ProjectilesRenderer())
                .AddComponent(new MaterialsMap(new BasicMaterial("Content/Textures/Blaster.png", DefaultLayers.Additive)));
            this.EntityManager.Add(blueProjectiles);

            // Explosion
            ExplosionDecorator explosion = new ExplosionDecorator("explosion", 2556);
            explosion.Transform3D.Position = new Vector3(-1109.993f, 0.437f, -3785.457f);
            this.EntityManager.Add(explosion.Entity);

            // Add asteroidfield
            var asteroidField = new AsteroidFieldDecorator("asteroidField", new Vector3(2000, 2000, 0));
            this.EntityManager.Add(asteroidField);

            // Add starfield
            var starField = new StarfieldDecorator("starfield");
            this.EntityManager.Add(starField);

            Dictionary<string, Material> materials = new Dictionary<string, Material>()
            {
                {
                    "Planet",
                    new BasicMaterial("Content/Textures/planet.png", typeof(PlanetLayer))
                },
                {
                    "BackSun",
                    new BasicMaterial("Content/Textures/StarShine.png", typeof(StarfieldLayer)){DiffuseColor = Color.White * 0.8f}
                },
                {
                    "FrontSun",
                    new BasicMaterial("Content/Textures/StarShine.png", DefaultLayers.Additive){DiffuseColor = Color.White * 0.4f}
                }
            };

            // Add background planet
            var planet = new Entity("planet")
            .AddComponent(new Transform3D())
            .AddComponent(new Model("Content/Models/Planet.FBX"))
            .AddComponent(new ModelRenderer())
            .AddComponent(new MaterialsMap(materials))
            .AddComponent(new FollowCameraBehavior())
            ;
            this.EntityManager.Add(planet);

            PointLight light = new PointLight("light", new Vector3(-30000, 17000, -15000))
            {
                Attenuation = 1900000,
                IsVisible = true,
                Color = Color.White
            };

            this.EntityManager.Add(light);
        }