internal Color ApplyWeatherMod(Color baseColor) { Color modColor; WeatherMod wthMod = GetWeatherMod(TimeWeather.currentWeather); float sMod = wthMod.sMod, vMod = wthMod.vMod, rMod = wthMod.rMod, gMod = wthMod.gMod, bMod = wthMod.bMod; if (TimeWeather.currentWeatherPct < 1f) { WeatherMod wthPrev = GetWeatherMod(TimeWeather.previousWeather); sMod = Mathf.Lerp(wthPrev.sMod, wthMod.sMod, TimeWeather.currentWeatherPct); vMod = Mathf.Lerp(wthPrev.vMod, wthMod.vMod, TimeWeather.currentWeatherPct); rMod = Mathf.Lerp(wthPrev.rMod, wthMod.rMod, TimeWeather.currentWeatherPct); gMod = Mathf.Lerp(wthPrev.gMod, wthMod.gMod, TimeWeather.currentWeatherPct); bMod = Mathf.Lerp(wthPrev.bMod, wthMod.bMod, TimeWeather.currentWeatherPct); } baseColor.r *= rMod; baseColor.g *= gMod; baseColor.b *= bMod; ColorHSV cHSV = new ColorHSV(baseColor); cHSV.s *= sMod; cHSV.v *= vMod; modColor = cHSV; modColor.a = 1; return(modColor); }
internal WeatherMod GetWeatherMod(string weather) { WeatherMod wm = new WeatherMod(); if (data.weathers.ContainsKey(weather)) { wm = data.weathers[weather]; } else if (data.weathers.ContainsKey("default")) { wm = data.weathers["default"]; } return(wm); }
internal float ApplyWeatherRangeMod() { float rngMod = 1f; WeatherMod wthMod = GetWeatherMod(TimeWeather.currentWeather); rngMod = wthMod.intMod; if (TimeWeather.currentWeatherPct < 1f) { WeatherMod wthPrev = GetWeatherMod(TimeWeather.previousWeather); rngMod = Mathf.Lerp(wthPrev.intMod, wthMod.intMod, TimeWeather.currentWeatherPct); } return(rngMod); }
internal float ApplyWeatherSaturationMod() { float sMod = 1f; WeatherMod wthMod = GetWeatherMod(TimeWeather.currentWeather); sMod = wthMod.sMod; if (TimeWeather.currentWeatherPct < 1f) { WeatherMod wthPrev = GetWeatherMod(TimeWeather.previousWeather); sMod = Mathf.Lerp(wthPrev.sMod, wthMod.sMod, TimeWeather.currentWeatherPct); } return(sMod); }