/// <summary> /// Loads the content. /// </summary> protected override void LoadContent() { // Load content for the game or screen this.webUIComponent = new WebUIScreenDrawableComponent(this.GameWorld, 1280, 720, Vector2.Zero); this.webUIComponent.RegisterEventCallback("game:spawnLight", this.SpawnLight); this.backgroundSprite = new TiledSprite(this.GameWorld, "Content/stone", null, Vector2.Zero, new Vector2(this.GraphicsDeviceManager.PreferredBackBufferWidth, this.GraphicsDeviceManager.PreferredBackBufferHeight) * this.GameWorld.WorldPerPixelRatio) { LayerDepth = 1, RenderOptions = SpriteRenderOptions.IsLit }; var newLight = new BouncyPointLight(this.GameWorld) { Position = new Vector3(Vector2.Zero, 0.15f), Velocity = this.GetRandomVelocity(), Color = this.GetRandomColor(), Power = 0.25f, Range = this.prng.Next(300, 500) / 100.0f, SpecularStrength = 2.75f, CastsShadows = true, LayerDepth = 2 }; var amLight = new AmbientLight(Color.White, 0.2f, true, 1); this.RenderSystem.AddPostProcessEffect(newLight); this.RenderSystem.AddPostProcessEffect(amLight); this.GameCamera.Position = new Vector2(this.GraphicsDeviceManager.PreferredBackBufferWidth, this.GraphicsDeviceManager.PreferredBackBufferHeight) * this.GameWorld.WorldPerPixelRatio * 0.5f; base.LoadContent(); }
private void SpawnLight(string data) { var newLight = new BouncyPointLight(this.GameWorld) { Position = new Vector3(Vector2.Zero, 0.15f), Velocity = this.GetRandomVelocity(), Color = this.GetRandomColor(), Power = 0.25f, Range = this.prng.Next(300, 500) / 100.0f, SpecularStrength = 2.75f, CastsShadows = true, LayerDepth = 2 }; this.RenderSystem.AddPostProcessEffect(newLight); }