public static void OnEditorInit(KiteSettings settings = null) { if (!IsInitialized(settings)) { Initialize(settings); } }
internal static KiteSettings GetOrCreateSettings() { if (KiteSettings.instance) { return(KiteSettings.instance); } string assetPath = $"{path}/{KiteSettings.resourceName}.asset"; KiteSettings settings = AssetDatabase.LoadAssetAtPath <KiteSettings>(assetPath); if (settings == null) { settings = ScriptableObject.CreateInstance <KiteSettings>(); if (!AssetDatabase.IsValidFolder(path)) { Debug.Log($"{path} is not a valid folder"); AssetDatabase.CreateFolder("Assets/Kite", "Resources"); } AssetDatabase.CreateAsset(settings, assetPath); AssetDatabase.SaveAssets(); } KiteSettings.instance = settings; return(settings); }
public static void EditorInit() { KiteSettings settings = GetOrCreateSettings(); Dir4Settings.OnEditorInit(settings); DirXSettings.OnEditorInit(settings); DirYSettings.OnEditorInit(settings); TileHelpers.OnSettings(settings); }
public static bool IsInitialized(KiteSettings settings = null) { if (!settings) { settings = KiteSettingsEditor.GetOrCreateSettings(); } return( settings.rightDirX && DirX.right && settings.leftDirX && DirX.left ); }
public static bool IsInitialized(KiteSettings settings = null) { if (!settings) { settings = KiteSettingsEditor.GetOrCreateSettings(); } return( settings.upDir4 && DirY.up && settings.downDir4 && DirY.down ); }
public static void Initialize(KiteSettings settings = null) { if (!settings) { settings = KiteSettingsEditor.GetOrCreateSettings(); } SerializedObject serializedObject = KiteSettingsEditor.GetSerializedSettings(); serializedObject.FindProperty(nameof(settings.rightDirX)).objectReferenceValue = InitRightDirX(); serializedObject.FindProperty(nameof(settings.leftDirX)).objectReferenceValue = InitLeftDirX(); serializedObject.ApplyModifiedProperties(); DirX.OnSettings(settings); }
public static void Initialize(KiteSettings settings = null) { if (!settings) { settings = KiteSettingsEditor.GetOrCreateSettings(); } SerializedObject serializedObject = KiteSettingsEditor.GetSerializedSettings(); serializedObject.FindProperty(nameof(settings.upDirY)).objectReferenceValue = InitUpDirY(); serializedObject.FindProperty(nameof(settings.downDirY)).objectReferenceValue = InitDownDirY(); serializedObject.ApplyModifiedProperties(); DirY.OnSettings(settings); }