CapersProject/Packages/com.distantlands.cozy.core/Runtime/Data/ForecastProfile.cs

81 lines
2.7 KiB
C#
Raw Normal View History

2024-06-03 18:26:03 +00:00
// Distant Lands 2024
// COZY: Stylized Weather 3
// All code included in this file is protected under the Unity Asset Store Eula
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
#endif
using UnityEngine;
namespace DistantLands.Cozy.Data
{
[System.Serializable]
[CreateAssetMenu(menuName = "Distant Lands/Cozy/Forecast Profile", order = 361)]
public class ForecastProfile : ScriptableObject
{
[Tooltip("The weather profiles that this profile will forecast.")]
public List<WeatherProfile> profilesToForecast;
[Tooltip("The weather profile that this profile will forecast initially.")]
public WeatherProfile initialProfile;
[Tooltip("The weather profiles that this profile will forecast initially.")]
public List<CozyEcosystem.WeatherPattern> initialForecast;
public enum StartWeatherWith { random, initialProfile, initialForecast }
public StartWeatherWith startWeatherWith;
[Tooltip("The amount of weather profiles to forecast ahead.")]
public int forecastLength;
}
#if UNITY_EDITOR
[CustomEditor(typeof(ForecastProfile))]
[CanEditMultipleObjects]
public class E_ForecastProfile : Editor
{
SerializedProperty profilesToForecast;
SerializedProperty forecastLength;
SerializedProperty startWeatherWith;
SerializedProperty startWithRandomWeather;
ForecastProfile prof;
Vector2 scrollPos;
void OnEnable()
{
profilesToForecast = serializedObject.FindProperty("profilesToForecast");
forecastLength = serializedObject.FindProperty("forecastLength");
startWithRandomWeather = serializedObject.FindProperty("startWeatherWith");
prof = (ForecastProfile)target;
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(profilesToForecast);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(startWithRandomWeather);
if (startWithRandomWeather.enumValueIndex == (int)ForecastProfile.StartWeatherWith.initialProfile)
EditorGUILayout.PropertyField(serializedObject.FindProperty("initialProfile"));
if (startWithRandomWeather.enumValueIndex == (int)ForecastProfile.StartWeatherWith.initialForecast)
EditorGUILayout.PropertyField(serializedObject.FindProperty("initialForecast"), true);
EditorGUILayout.Space();
EditorGUILayout.PropertyField(forecastLength, new GUIContent("Profiles to Forecast Ahead"));
serializedObject.ApplyModifiedProperties();
}
}
#endif
}