예제 #1
0
 public static void OnEditorInit(KiteSettings settings = null)
 {
     if (!IsInitialized(settings))
     {
         Initialize(settings);
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
        public static void EditorInit()
        {
            KiteSettings settings = GetOrCreateSettings();

            Dir4Settings.OnEditorInit(settings);
            DirXSettings.OnEditorInit(settings);
            DirYSettings.OnEditorInit(settings);
            TileHelpers.OnSettings(settings);
        }
예제 #4
0
        public static bool IsInitialized(KiteSettings settings = null)
        {
            if (!settings)
            {
                settings = KiteSettingsEditor.GetOrCreateSettings();
            }

            return(
                settings.rightDirX && DirX.right &&
                settings.leftDirX && DirX.left
                );
        }
예제 #5
0
        public static bool IsInitialized(KiteSettings settings = null)
        {
            if (!settings)
            {
                settings = KiteSettingsEditor.GetOrCreateSettings();
            }

            return(
                settings.upDir4 && DirY.up &&
                settings.downDir4 && DirY.down
                );
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }