Simple Pigman AI

This commit is contained in:
Michal Pikulski
2025-12-04 08:52:59 +01:00
committed by Michal Pikulski
parent 9b71b00441
commit a463e099b4
27 changed files with 7452 additions and 428 deletions

View File

@@ -90,5 +90,35 @@ namespace AppleHills
}
// Add more methods as needed for other settings
/// <summary>
/// Get developer settings for editor-mode usage (OnDrawGizmos, etc.)
/// This handles both editor and play mode seamlessly.
/// </summary>
public static T GetDeveloperSettingsForEditor<T>() where T : AppleHills.Core.Settings.BaseDeveloperSettings
{
#if UNITY_EDITOR
if (!Application.isPlaying)
{
// In editor mode (not playing), use reflection to access EditorSettingsProvider
// This avoids direct reference to Editor assembly from runtime code
var editorProviderType = System.Type.GetType("AppleHills.Editor.EditorSettingsProvider, Assembly-CSharp-Editor");
if (editorProviderType != null)
{
var method = editorProviderType.GetMethod("GetDeveloperSettings",
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
if (method != null)
{
var genericMethod = method.MakeGenericMethod(typeof(T));
return genericMethod.Invoke(null, null) as T;
}
}
return null;
}
#endif
// In play mode, use GameManager
return GameManager.GetDeveloperSettings<T>();
}
}
}