diff --git a/Revitalize/Revitalize/Revitalize/Aesthetics/WeatherDebris/WeatherDebrisPlus.cs b/Revitalize/Revitalize/Revitalize/Aesthetics/WeatherDebris/WeatherDebrisPlus.cs index e0e91033..93b3d276 100644 --- a/Revitalize/Revitalize/Revitalize/Aesthetics/WeatherDebris/WeatherDebrisPlus.cs +++ b/Revitalize/Revitalize/Revitalize/Aesthetics/WeatherDebris/WeatherDebrisPlus.cs @@ -12,25 +12,35 @@ namespace Revitalize.Aesthetics.WeatherDebris public class WeatherDebrisPlus { - - - public Rectangle sourceRect; - public bool blowing; public Vector2 position; public int which; public float dx; public float dy; public int animationIntervalOffset; + public Texture2D debrisTexture; public WeatherDebrisPlus() { } - - public WeatherDebrisPlus(Vector2 position,Rectangle SourceRect, int animationOffset, int which, float rotationVelocity, float dx, float dy) + + /// + /// Create a new debris particle to be shown across the screen. + /// + /// + /// Source on the texture sprite sheet. + /// + /// Not really used, but can be used for default list. + /// + /// + /// + /// If NULL, then Game1.mouseCursors is used. + public WeatherDebrisPlus(Vector2 position,Rectangle SourceRect, int animationOffset, int which, float rotationVelocity, float dx, float dy, Texture2D texture=null) { + if (texture == null) debrisTexture = Game1.mouseCursors; + else debrisTexture = texture; this.position = position; this.which = which; this.dx = dx; @@ -39,7 +49,17 @@ namespace Revitalize.Aesthetics.WeatherDebris animationIntervalOffset = animationOffset; } - public WeatherDebrisPlus(Vector2 position, Rectangle SourceRect, int animationOffset, int which, float rotationVelocity, float dx, float dy,bool specificSetUp) + /// + /// Default system that uses some presets. Might or might not use. + /// + /// + /// Source on the texture sprite sheet. + /// + /// Not really used, but can be used for default list. + /// + /// + /// + public WeatherDebrisPlus(Vector2 position, Rectangle SourceRect, int animationOffset, int which, float rotationVelocity, float dx, float dy) { this.position = position; this.which = which; @@ -47,10 +67,6 @@ namespace Revitalize.Aesthetics.WeatherDebris this.dy = dy; // sourceRect = SourceRect; animationIntervalOffset = animationOffset; - - Log.AsyncC(this.dx); - Log.AsyncC(this.dy); - switch (which) { case 0: @@ -129,7 +145,7 @@ namespace Revitalize.Aesthetics.WeatherDebris public void draw(SpriteBatch b) { - b.Draw(Game1.mouseCursors, this.position, new Rectangle?(this.sourceRect), Color.White, 0f, Vector2.Zero, 3f, SpriteEffects.None, 1E-06f); + b.Draw(this.debrisTexture, this.position, new Rectangle?(this.sourceRect), Color.White, 0f, Vector2.Zero, 3f, SpriteEffects.None, 1E-06f); } } diff --git a/Revitalize/Revitalize/Revitalize/Aesthetics/WeatherDebris/WeatherDebrisSystem.cs b/Revitalize/Revitalize/Revitalize/Aesthetics/WeatherDebris/WeatherDebrisSystem.cs index fb225493..db6ed88e 100644 --- a/Revitalize/Revitalize/Revitalize/Aesthetics/WeatherDebris/WeatherDebrisSystem.cs +++ b/Revitalize/Revitalize/Revitalize/Aesthetics/WeatherDebris/WeatherDebrisSystem.cs @@ -4,7 +4,9 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Timers; using System.Threading.Tasks; +using StardewModdingAPI; namespace Revitalize.Aesthetics.WeatherDebris { @@ -13,6 +15,8 @@ namespace Revitalize.Aesthetics.WeatherDebris { public WeatherDebrisPlus weatherDebris; public int TimesToAdd; + + public weatherNode(WeatherDebrisPlus w, int addThisMany) { @@ -24,6 +28,8 @@ namespace Revitalize.Aesthetics.WeatherDebris class WeatherDebrisSystem { public static List thisWeatherDebris; + public static Timer debrisClearTimer; + public static float oldWindGust; public static void update() { foreach (WeatherDebrisPlus w in WeatherDebrisSystem.thisWeatherDebris) @@ -45,9 +51,14 @@ namespace Revitalize.Aesthetics.WeatherDebris } - public static void cleanWeatherDebris() + public static void cleanWeatherDebrisTimer(System.Object source, ElapsedEventArgs e) { thisWeatherDebris.Clear(); + debrisClearTimer.Enabled = false; + debrisClearTimer.Dispose(); + Game1.windGust = 0.0f; + StardewValley.WeatherDebris.globalWind = oldWindGust; + // Log.AsyncG("Cleared Wind Debris"); } public static void addMultipleDebrisWithVaryingCounts(List listToAdd) @@ -67,10 +78,26 @@ namespace Revitalize.Aesthetics.WeatherDebris if (w.TimesToAdd == 0 || w.weatherDebris == null) return; for(int i = 1; i <= w.TimesToAdd; i++) { - var v= new WeatherDebrisPlus(new Vector2((float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Width), (float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Height)), w.weatherDebris.sourceRect, w.weatherDebris.animationIntervalOffset, w.weatherDebris.which, (float)Game1.random.Next(15) / 500f, (float)Game1.random.Next(-10, 0) / 50f, (float)Game1.random.Next(10) / 50f, true); + var v= new WeatherDebrisPlus(new Vector2((float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Width), (float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Height)), w.weatherDebris.sourceRect, w.weatherDebris.animationIntervalOffset, w.weatherDebris.which, (float)Game1.random.Next(15) / 500f, (float)Game1.random.Next(-10, 0) / 50f, (float)Game1.random.Next(10) / 50f,w.weatherDebris.debrisTexture); thisWeatherDebris.Add(v); } } + public static void speedUpWindAndClear(float f) + { + oldWindGust= StardewValley.WeatherDebris.globalWind; + for (float g=StardewValley.WeatherDebris.globalWind; g <= 2f; g += f) + { + StardewValley.Game1.windGust = g; + } + debrisClearTimer = new Timer(5000); + debrisClearTimer.Elapsed += cleanWeatherDebrisTimer; + debrisClearTimer.Start(); + debrisClearTimer.AutoReset = false; + debrisClearTimer.Enabled = true; + // StardewValley.Game1.windGust = d; + // thisWeatherDebris.Clear(); + } + } } diff --git a/Revitalize/Revitalize/Revitalize/Class1.cs b/Revitalize/Revitalize/Revitalize/Class1.cs index 37341e79..58163b4d 100644 --- a/Revitalize/Revitalize/Revitalize/Class1.cs +++ b/Revitalize/Revitalize/Revitalize/Class1.cs @@ -350,7 +350,10 @@ namespace Revitalize newDebris(); } - + if (e.KeyPressed.ToString() == "G") + { + WeatherDebrisSystem.speedUpWindAndClear(0.001f); + } } @@ -361,14 +364,9 @@ namespace Revitalize // WeatherDebris w = new WeatherDebris(); // Game1.debrisWeather.Add(new WeatherDebris(new Vector2((float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Width), (float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Height)), 0, (float)Game1.random.Next(15) / 500f, (float)Game1.random.Next(-10, 0) / 50f, (float)Game1.random.Next(10) / 50f)); // WeatherDebris w = new WeatherDebris(new Vector2((float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Width), (float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Height)), 0, (float)Game1.random.Next(15) / 500f, (float)Game1.random.Next(-10, 0) / 50f, (float)Game1.random.Next(10) / 50f); - WeatherDebrisPlus w= new WeatherDebrisPlus(new Vector2((float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Width), (float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Height)), new Rectangle(338, 400, 8, 8), 0, 4, (float)Game1.random.Next(15) / 500f, (float)Game1.random.Next(-10, 0) / 50f, (float)Game1.random.Next(10) / 50f,true); + WeatherDebrisPlus w= new WeatherDebrisPlus(new Vector2((float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Width), (float)Game1.random.Next(0, Game1.graphics.GraphicsDevice.Viewport.Height)), new Rectangle(338, 400, 8, 8), 0, 4, (float)Game1.random.Next(15) / 500f, (float)Game1.random.Next(-10, 0) / 50f, (float)Game1.random.Next(10) / 50f); WeatherDebrisSystem.addMultipleDebrisFromSingleType(new weatherNode(w, 20)); - // WeatherDebrisSystem.thisWeatherDebris.Add(w); - - Game1.isDebrisWeather = true; - // Game1.updateDebrisWeatherForMovement(Game1.debrisWeather); - // Game1.windGust = 0.15f; - Log.AsyncC("WIND"); + Game1.isDebrisWeather = true; } diff --git a/Revitalize/Revitalize/Revitalize/bin/Debug/Revitalize.dll b/Revitalize/Revitalize/Revitalize/bin/Debug/Revitalize.dll index 909d9873..dcf5fc4d 100644 Binary files a/Revitalize/Revitalize/Revitalize/bin/Debug/Revitalize.dll and b/Revitalize/Revitalize/Revitalize/bin/Debug/Revitalize.dll differ diff --git a/Revitalize/Revitalize/Revitalize/obj/Debug/Revitalize.dll b/Revitalize/Revitalize/Revitalize/obj/Debug/Revitalize.dll index 909d9873..dcf5fc4d 100644 Binary files a/Revitalize/Revitalize/Revitalize/obj/Debug/Revitalize.dll and b/Revitalize/Revitalize/Revitalize/obj/Debug/Revitalize.dll differ