internal static float ShadowOpacity() { if (bThunder) { return(ThunderEffect.ShadowOpacity()); } else { return(DayLightHandler.ShadowOpacity); } }
internal static void Update(GameTime gt) { if (false) { bRaining = true; bThunder = true; } else { bRaining = false; bThunder = false; } if (bRaining) { TestEnvironment.UpdateRain(gt); } if (bThunder) { ThunderEffect.Update(gt.ElapsedGameTime.Milliseconds); } }
static public void DrawWithEffects(SpriteBatch sb, RenderTarget2D r2d) { if (lightTex == null) { //lightTex = Game1.contentManager.Load<Texture2D>("light"); } sb.End(); sb.GraphicsDevice.SetRenderTarget(null); sb.GraphicsDevice.SetRenderTarget(trueLightMask); sb.GraphicsDevice.Clear(Color.TransparentBlack); sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, GameProcessor.CameraScaleMatrix); foreach (var item in GameProcessor.loadedMap.activeLights.FindAll(l => l.bIsLightOn)) { if (item.bIsLightOn) { Color c = item.lightColor; item.lightMask.DrawLight(sb, item, item.spriteGameSize.Center.ToVector2() - (new Vector2(item.lightMask.animationFrames[0].Width / 2, item.lightMask.animationFrames[0].Height / 2)) * item.lightScale, item.lightScale, c); } } sb.End(); sb.GraphicsDevice.SetRenderTarget(null); sb.GraphicsDevice.SetRenderTarget(lightMask); if (GameProcessor.bIsOverWorldOutsideGame) { sb.GraphicsDevice.Clear(worldColor * worldBrightnessLM); } else if (true) { sb.GraphicsDevice.Clear(Color.White); } sb.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp); if (ThunderEffect.IsShowing()) { var c = ThunderEffect.GetColor(); sb.Draw(Game1.WhiteTex, new Rectangle(0, 0, 1366, 768), c * .95f); } sb.End(); sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, GameProcessor.CameraScaleMatrix); foreach (var item in GameProcessor.loadedMap.activeLights) { // sb.Draw(lightTex, item.spriteGameSize.Center.ToVector2() - (item.spriteGameSize.Center.ToVector2() - item.spriteGameSize.Location.ToVector2()) * scale, lightTex.Bounds, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0); // item.Draw(sb); // item.lightColor = Color.White; if (item.bIsLightOn) { item.lightMask.DrawLight(sb, item, item.spriteGameSize.Center.ToVector2() - (new Vector2(item.lightMask.animationFrames[0].Width / 2, item.lightMask.animationFrames[0].Height / 2)) * item.lightScale, item.lightScale, item.lightColor); } } sb.End(); sb.End(); sb.GraphicsDevice.SetRenderTarget(Game1.gameRender); sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, SceneUtility.transform); //sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null, SceneUtility.transform); lightEffect.Parameters["lightMask"].SetValue(lightMask); // lightEffect.Parameters["truelightMask"].SetValue(trueLightMask); // lightEffect.Parameters["heightMask"].SetValue(GameProcessor.loadedMap.GetHeightMask()); lightEffect.Parameters["mod"].SetValue((float)(1.0f - worldBrightnessLM)); // lightEffect.Parameters["mod2"].SetValue((float)(1f)); // lightEffect.Parameters["brightness"].SetValue((float)(worldBrightnessLM)); //lightEffect.CurrentTechnique.Passes[0].Apply(); lightEffect.CurrentTechnique.Passes[0].Apply(); Rectangle renderBounds = new Rectangle(r2d.Bounds.X, r2d.Bounds.Y + ZoomHorizontalModifier, r2d.Bounds.Width, r2d.Bounds.Height - 2 * ZoomHorizontalModifier); // sb.Draw(r2d, renderBounds, renderBounds, Color.White); // sb.Draw(GameProcessor.objectRender, renderBounds, renderBounds, Color.Red); switch (currentEffect) { case Effects.None: renderBounds = new Rectangle(r2d.Bounds.X, r2d.Bounds.Y + ZoomHorizontalModifier, r2d.Bounds.Width, r2d.Bounds.Height - 2 * ZoomHorizontalModifier); if (currentTransform == Transform.None) { sb.Draw(r2d, renderBounds, renderBounds, Color.White); } else if (currentTransform == Transform.Zoom) { sb.Draw(r2d, -adjustZoomPosRender, renderBounds, Color.White, 0f, Vector2.Zero, zoomTo, SpriteEffects.None, 0); } break; case Effects.Conversation: sb.Draw(r2d, renderBounds, renderBounds, Color.White); break; case Effects.RegionName: sb.Draw(r2d, renderBounds, renderBounds, Color.White); break; case Effects.Shake: renderBounds.X += GamePlayUtility.Randomize(-35, 35); renderBounds.Y += GamePlayUtility.Randomize(-35, 35); sb.Draw(r2d, renderBounds, new Rectangle(r2d.Bounds.X, r2d.Bounds.Y + ZoomHorizontalModifier, r2d.Bounds.Width, r2d.Bounds.Height - 2 * ZoomHorizontalModifier), Color.White); break; default: break; } //sb.Draw(GameProcessor.loadedMap.GetHeightMask(), renderBounds, Color.White); sb.End(); }