Files
zzz_REBIRTH__Utils/Scripts/MinEvents/MinEventActionChangeWeatherRebirth.cs
2025-06-04 16:44:53 +09:30

88 lines
2.6 KiB
C#

using System.Xml.Linq;
public class MinEventActionChangeWeatherRebirth : MinEventActionRemoveBuff
{
string fogColor = "";
float windForce = 0f;
float rain = -1f;
float clouds = -1f;
public override void Execute(MinEventParams _params)
{
if (GameManager.IsDedicatedServer)
{
return;
}
string[] fogColors = fogColor.Split(',', (char)StringSplitOptions.None);
if (fogColor.Trim().Length > 0)
{
if (fogColor == "clear")
{
SkyManager.SetFogDebugColor(Color.grey);
}
else
{
SkyManager.SetFogDebugColor(new Color(float.Parse(fogColors[0]), float.Parse(fogColors[1]), float.Parse(fogColors[2])));
}
}
if (windForce > 0f)
{
//Log.Out("MinEventActionChangeWeatherRebirth-Execute windForce: " + windForce);
WeatherManager.forceWind = Mathf.Clamp(windForce, -1f, 200f);
//Log.Out("MinEventActionChangeWeatherRebirth-Execute WeatherManager.forceWind: " + WeatherManager.forceWind);
}
if (rain > -1f)
{
//Log.Out("MinEventActionChangeWeatherRebirth-Execute rain: " + rain);
WeatherManager.forceRain = Mathf.Clamp(rain, -1f, 1f);
//Log.Out("MinEventActionChangeWeatherRebirth-Execute WeatherManager.forceRain: " + WeatherManager.forceRain);
}
if (clouds > -1f)
{
//Log.Out("MinEventActionChangeWeatherRebirth-Execute clouds: " + clouds);
WeatherManager.forceClouds = Mathf.Clamp(clouds, -1f, 1f);
//Log.Out("MinEventActionChangeWeatherRebirth-Execute WeatherManager.forceClouds: " + WeatherManager.forceClouds);
}
}
public override bool ParseXmlAttribute(XAttribute _attribute)
{
var flag = base.ParseXmlAttribute(_attribute);
if (flag) return true;
var name = _attribute.Name;
if (name == null)
{
return flag;
}
else if (name == "fogColor")
{
fogColor = _attribute.Value;
return true;
}
else if (name == "windForce")
{
windForce = float.Parse(_attribute.Value);
return true;
}
else if (name == "rain")
{
rain = float.Parse(_attribute.Value);
return true;
}
else if (name == "clouds")
{
clouds = float.Parse(_attribute.Value);
return true;
}
else
{
return false;
}
}
}