Beispiel #1
0
        // PUBLIC STATIC METHODS: -----------------------------------------------------------------

        public static AssetManifest GetInstance()
        {
            if (AssetManifest.Instance != null)
            {
                return(AssetManifest.Instance);
            }

            AssetManifest manifest;
            string        absPath = Path.Combine(Application.dataPath, Path.Combine(ASSET_PATH, ASSET_NAME));
            string        relPath = string.Format(RELATIVE_PATH, ASSET_PATH, ASSET_NAME);

            if (File.Exists(absPath))
            {
                manifest = AssetDatabase.LoadAssetAtPath <AssetManifest>(relPath);
            }
            else
            {
                string dirPath = string.Format(RELATIVE_PATH, ASSET_PATH, "");
                GameCreatorUtilities.CreateFolderStructure(dirPath);

                manifest = ScriptableObject.CreateInstance <AssetManifest>();
                AssetDatabase.CreateAsset(manifest, relPath);
            }

            AssetManifest.Instance = manifest;
            return(AssetManifest.Instance);
        }
Beispiel #2
0
        private void SetupActionsList(ref SerializedProperty sp, ref IActionsListEditor editor,
                                      string prefabPath, string prefabName)
        {
            if (sp.objectReferenceValue == null)
            {
                GameCreatorUtilities.CreateFolderStructure(prefabPath);
                string actionsPath = AssetDatabase.GenerateUniqueAssetPath(Path.Combine(
                                                                               prefabPath, prefabName
                                                                               ));

                GameObject sceneInstance = new GameObject("Actions");
                sceneInstance.AddComponent <Actions>();

                GameObject prefabInstance = PrefabUtility.SaveAsPrefabAsset(sceneInstance, actionsPath);
                DestroyImmediate(sceneInstance);

                Actions prefabActions = prefabInstance.GetComponent <Actions>();
                prefabActions.destroyAfterFinishing = true;
                sp.objectReferenceValue             = prefabActions.actionsList;
                serializedObject.ApplyModifiedPropertiesWithoutUndo();
                serializedObject.Update();
            }

            editor = Editor.CreateEditor(
                sp.objectReferenceValue,
                typeof(IActionsListEditor)
                ) as IActionsListEditor;
        }
Beispiel #3
0
        private void UpdateInitActions()
        {
            if (!this.spUseActionsList.boolValue)
            {
                return;
            }
            if (this.spPrefabActionsList.objectReferenceValue == null)
            {
                string actionsName = Guid.NewGuid().ToString("N");
                GameCreatorUtilities.CreateFolderStructure(PATH_ACTIONS);
                string path = Path.Combine(PATH_ACTIONS, string.Format(PREFAB_NAME, actionsName));
                path = AssetDatabase.GenerateUniqueAssetPath(path);

                GameObject sceneInstance = new GameObject(actionsName);
                sceneInstance.AddComponent <Actions>();

                GameObject prefabInstance = PrefabUtility.SaveAsPrefabAsset(sceneInstance, path);
                DestroyImmediate(sceneInstance);

                Actions prefabActions = prefabInstance.GetComponent <Actions>();
                prefabActions.destroyAfterFinishing           = true;
                this.spPrefabActionsList.objectReferenceValue = prefabActions.actionsList;

                this.serializedObject.ApplyModifiedPropertiesWithoutUndo();
                this.serializedObject.Update();
            }

            if (this.editorActionsList == null)
            {
                this.editorActionsList = Editor.CreateEditor(
                    this.spPrefabActionsList.objectReferenceValue
                    ) as IActionsListEditor;
            }
        }
        public static StatusEffectAsset AddStatusEffectAsset()
        {
            StatusEffectAsset statusEffectAsset = ScriptableObject.CreateInstance <StatusEffectAsset>();

            statusEffectAsset.name = GameCreatorUtilities.RandomHash(8);

            string path = Path.Combine(ASSETS_PATH, STAEFASSET_FILE);

            AssetDatabase.AddObjectToAsset(statusEffectAsset, path);

            return(statusEffectAsset);
        }
        public static AttrAsset AddAttributeAsset()
        {
            AttrAsset attrAsset = ScriptableObject.CreateInstance <AttrAsset>();

            attrAsset.name = GameCreatorUtilities.RandomHash(8);

            string path = Path.Combine(ASSETS_PATH, ATTRSASSET_FILE);

            AssetDatabase.AddObjectToAsset(attrAsset, path);

            return(attrAsset);
        }
        // PRIVATE METHODS: -----------------------------------------------------------------------

        private static T CreateAsset <T>(string filepath, string filename) where T : ScriptableObject
        {
            T asset = ScriptableObject.CreateInstance <T>();

            GameCreatorUtilities.CreateFolderStructure(filepath);
            string path = Path.Combine(filepath, filename);

            path = AssetDatabase.GenerateUniqueAssetPath(path);

            AssetDatabase.CreateAsset(asset, path);
            AssetDatabase.ImportAsset(path);
            return(asset);
        }
        protected override SOVariable CreateReferenceInstance(string name)
        {
            SOVariable variable = ScriptableObject.CreateInstance <SOVariable>();

            variable.name          = GameCreatorUtilities.RandomHash(8);
            variable.variable.name = name;

            AssetDatabase.AddObjectToAsset(variable, this.instance);
            AssetDatabase.SaveAssets();
            AssetDatabase.ImportAsset(Path.Combine(PATH_ASSET, NAME_ASSET));

            return(variable);
        }
        public static StatusEffectsAsset CreateStatusEffectsAsset()
        {
            string filepath = ASSETS_PATH;
            string filename = STAEFASSET_FILE;

            StatusEffectsAsset asset = ScriptableObject.CreateInstance <StatusEffectsAsset>();

            GameCreatorUtilities.CreateFolderStructure(filepath);
            string path = Path.Combine(filepath, filename);

            path = AssetDatabase.GenerateUniqueAssetPath(path);

            AssetDatabase.CreateAsset(asset, path);
            AssetDatabase.ImportAsset(path);
            return(asset);
        }
        private static QuestReaction CreateReaction(string filename, string pathname)
        {
            GameObject sceneInstance = new GameObject("Reaction");

            sceneInstance.AddComponent <QuestReaction>();

            GameCreatorUtilities.CreateFolderStructure(pathname);
            string path = Path.Combine(pathname, filename);

            path = AssetDatabase.GenerateUniqueAssetPath(path);

            GameObject prefabInstance = PrefabUtility.SaveAsPrefabAsset(sceneInstance, path);

            UnityEngine.Object.DestroyImmediate(sceneInstance);

            return(prefabInstance.GetComponent <QuestReaction>());
        }
        // INITIALIZE: ----------------------------------------------------------------------------

        private void OnEnable()
        {
            if (target == null || serializedObject == null)
            {
                return;
            }

            this.spTags = serializedObject.FindProperty(PROP_GLOBALTAGS);
            if (this.spTags.objectReferenceValue == null)
            {
                GameCreatorUtilities.CreateFolderStructure(GlobalTagsEditor.PATH_ASSET);
                GlobalTags instance = ScriptableObject.CreateInstance <GlobalTags>();
                AssetDatabase.CreateAsset(instance, Path.Combine(
                                              GlobalTagsEditor.PATH_ASSET,
                                              GlobalTagsEditor.NAME_ASSET
                                              ));

                this.spTags.objectReferenceValue = instance;
                serializedObject.ApplyModifiedPropertiesWithoutUndo();
                serializedObject.Update();
            }

            this.spVariables = serializedObject.FindProperty(PROP_GLOBALVARIABLES);
            if (this.spVariables.objectReferenceValue == null)
            {
                GameCreatorUtilities.CreateFolderStructure(GlobalVariablesEditor.PATH_ASSET);
                GlobalVariables instance = ScriptableObject.CreateInstance <GlobalVariables>();
                AssetDatabase.CreateAsset(instance, Path.Combine(
                                              GlobalVariablesEditor.PATH_ASSET,
                                              GlobalVariablesEditor.NAME_ASSET
                                              ));

                this.spVariables.objectReferenceValue = instance;
                serializedObject.ApplyModifiedPropertiesWithoutUndo();
                serializedObject.Update();
            }

            this.variablesEditor = (GlobalVariablesEditor)CreateEditor(
                this.spVariables.objectReferenceValue
                );
        }
Beispiel #11
0
        // METHODS: ----------------------------------------------------------------------------------------------------

        private void OnEnable()
        {
            this.spUUID        = serializedObject.FindProperty(PROP_UUID);
            this.spName        = serializedObject.FindProperty(PROP_NAME);
            this.spDescription = serializedObject.FindProperty(PROP_DESCRIPTION);
            this.spSprite      = serializedObject.FindProperty(PROP_SPRITE);
            this.spPrefab      = serializedObject.FindProperty(PROP_PREFAB);
            this.spPrice       = serializedObject.FindProperty(PROP_PRICE);
            this.spMaxStack    = serializedObject.FindProperty(PROP_MAXSTACK);

            this.spConsumable  = serializedObject.FindProperty(PROP_CONSUMABLE);
            this.spActionsList = serializedObject.FindProperty(PROP_ACTIONSLIST);
            if (this.spActionsList.objectReferenceValue == null)
            {
                GameCreatorUtilities.CreateFolderStructure(PATH_PREFAB_CONSUME);
                string actionsPath = AssetDatabase.GenerateUniqueAssetPath(Path.Combine(
                                                                               PATH_PREFAB_CONSUME, NAME_PREFAB_CONSUME)
                                                                           );

                GameObject sceneInstance = new GameObject("ConsumeActions");
                sceneInstance.AddComponent <Actions>();

                GameObject prefabInstance = PrefabUtility.CreatePrefab(actionsPath, sceneInstance);
                DestroyImmediate(sceneInstance);

                Actions prefabActions = prefabInstance.GetComponent <Actions>();
                prefabActions.destroyAfterFinishing     = true;
                this.spActionsList.objectReferenceValue = prefabActions.actionsList;
                serializedObject.ApplyModifiedProperties();
                serializedObject.Update();
            }

            this.actionsListEditor = (IActionsListEditor)IActionsListEditor.CreateEditor(
                this.spActionsList.objectReferenceValue, typeof(IActionsListEditor)
                );

            this.animUnfold       = new AnimBool(false);
            this.animUnfold.speed = ANIM_BOOL_SPEED;
            this.animUnfold.valueChanged.AddListener(this.Repaint);
        }
Beispiel #12
0
        // METHODS: ----------------------------------------------------------------------------------------------------

        private void OnEnable()
        {
            this.spItemHolderToCombineA = serializedObject.FindProperty(PROP_ITEM_1);
            this.spItemToCombineA       = this.spItemHolderToCombineA.FindPropertyRelative("item");
            this.spAmountA = serializedObject.FindProperty(PROP_AMOU_1);
            this.spItemHolderToCombineB = serializedObject.FindProperty(PROP_ITEM_2);
            this.spItemToCombineB       = this.spItemHolderToCombineB.FindPropertyRelative("item");
            this.spAmountB = serializedObject.FindProperty(PROP_AMOU_2);

            this.spRemoveItemsOnCraft = serializedObject.FindProperty(PROP_ONCRAFT);
            this.spActionsList        = serializedObject.FindProperty(PROP_ACTION);
            if (this.spActionsList.objectReferenceValue == null)
            {
                GameCreatorUtilities.CreateFolderStructure(PATH_PREFAB_RECIPES);
                string actionsPath = AssetDatabase.GenerateUniqueAssetPath(Path.Combine(
                                                                               PATH_PREFAB_RECIPES, NAME_PREFAB_RECIPES)
                                                                           );

                GameObject sceneInstance = new GameObject("RecipeActions");
                sceneInstance.AddComponent <Actions>();

                GameObject prefabInstance = PrefabUtility.CreatePrefab(actionsPath, sceneInstance);
                DestroyImmediate(sceneInstance);

                Actions prefabActions = prefabInstance.GetComponent <Actions>();
                prefabActions.destroyAfterFinishing     = true;
                this.spActionsList.objectReferenceValue = prefabActions.actionsList;
                serializedObject.ApplyModifiedProperties();
                serializedObject.Update();
            }

            this.actionsListEditor = (IActionsListEditor)IActionsListEditor.CreateEditor(
                this.spActionsList.objectReferenceValue, typeof(IActionsListEditor)
                );

            this.animUnfold       = new AnimBool(false);
            this.animUnfold.speed = ANIM_BOOL_SPEED;
            this.animUnfold.valueChanged.AddListener(this.Repaint);
        }
Beispiel #13
0
        private void InitActions(SerializedProperty property, string actionsPath)
        {
            if (property.objectReferenceValue == null)
            {
                string actionsName = Guid.NewGuid().ToString("N");
                GameCreatorUtilities.CreateFolderStructure(actionsPath);
                string path = Path.Combine(actionsPath, string.Format(PREFAB_NAME, actionsName));
                path = AssetDatabase.GenerateUniqueAssetPath(path);

                GameObject sceneInstance = new GameObject(actionsName);
                sceneInstance.AddComponent <Actions>();

                GameObject prefabInstance = PrefabUtility.SaveAsPrefabAsset(sceneInstance, path);
                DestroyImmediate(sceneInstance);

                Actions prefabActions = prefabInstance.GetComponent <Actions>();
                prefabActions.destroyAfterFinishing = true;
                property.objectReferenceValue       = prefabActions.actionsList;

                this.serializedObject.ApplyModifiedPropertiesWithoutUndo();
                this.serializedObject.Update();
            }
        }
        private void RequireActionsInit(ref SerializedProperty property, string prefabName, bool destroyAtFinish)
        {
            if (property.objectReferenceValue == null)
            {
                prefabName = string.Format(prefabName, GameCreatorUtilities.RandomHash(8));
                GameCreatorUtilities.CreateFolderStructure(PATH_PREFABS);
                string actionsPath = AssetDatabase.GenerateUniqueAssetPath(Path.Combine(
                                                                               PATH_PREFABS, prefabName)
                                                                           );

                GameObject sceneInstance = new GameObject(prefabName);
                sceneInstance.AddComponent <Actions>();

                GameObject prefabInstance = PrefabUtility.SaveAsPrefabAsset(sceneInstance, actionsPath);
                DestroyImmediate(sceneInstance);

                Actions prefabActions = prefabInstance.GetComponent <Actions>();
                prefabActions.destroyAfterFinishing = destroyAtFinish;

                property.objectReferenceValue = prefabActions.actionsList;
                serializedObject.ApplyModifiedPropertiesWithoutUndo();
                serializedObject.Update();
            }
        }
        // INITIALIZER: ---------------------------------------------------------------------------

        private void OnEnable()
        {
            this.instance = this.target as MeleeClip;

            this.sectionAnimation = new Section("Animation", this.LoadIcon("Animation"), this.Repaint);
            this.sectionMotion    = new Section("Motion", this.LoadIcon("Animation"), this.Repaint);
            this.sectionEffects   = new Section("Effects", this.LoadIcon("Effects"), this.Repaint);
            this.sectionCombat    = new Section("Combat", this.LoadIcon("Animation"), this.Repaint);

            this.spAnimationClip = this.serializedObject.FindProperty("animationClip");
            this.spAvatarMask    = this.serializedObject.FindProperty("avatarMask");
            this.spTransitionIn  = this.serializedObject.FindProperty("transitionIn");
            this.spTransitionOut = this.serializedObject.FindProperty("transitionOut");

            this.spMovementForward    = this.serializedObject.FindProperty("movementForward");
            this.spMovementSides      = this.serializedObject.FindProperty("movementSides");
            this.spMovementVertical   = this.serializedObject.FindProperty("movementVertical");
            this.spGravityInfluence   = this.serializedObject.FindProperty("gravityInfluence");
            this.spMovementMultiplier = this.serializedObject.FindProperty("movementMultiplier");

            this.spSoundEffect      = this.serializedObject.FindProperty("soundEffect");
            this.spPushForce        = this.serializedObject.FindProperty("pushForce");
            this.spHitPause         = this.serializedObject.FindProperty("hitPause");
            this.spHitPauseAmount   = this.serializedObject.FindProperty("hitPauseAmount");
            this.spHitPauseDuration = this.serializedObject.FindProperty("hitPauseDuration");

            this.spIsAttack    = this.serializedObject.FindProperty("isAttack");
            this.spIsBlockable = this.serializedObject.FindProperty("isBlockable");

            this.spPoiseDamage   = this.serializedObject.FindProperty("poiseDamage");
            this.spDefenseDamage = this.serializedObject.FindProperty("defenseDamage");

            this.spInterruptible = this.serializedObject.FindProperty("interruptible");
            this.spVulnerability = this.serializedObject.FindProperty("vulnerability");
            this.spPosture       = this.serializedObject.FindProperty("posture");

            this.spAttackPhase = serializedObject.FindProperty("attackPhase");

            if (!TEX_PREVIEW_ACCEPT)
            {
                TEX_PREVIEW_ACCEPT = MakeTexture(Color.green, 0.25f);
            }
            if (!TEX_PREVIEW_REJECT)
            {
                TEX_PREVIEW_REJECT = MakeTexture(Color.red, 0.25f);
            }
            if (!TEX_DARKER)
            {
                TEX_DARKER = MakeTexture(Color.black, 0.5f);
            }

            if (!TEX_ATK_PHASE1)
            {
                TEX_ATK_PHASE1 = MakeTexture(COLOR_PHASE1);
            }
            if (!TEX_ATK_PHASE2)
            {
                TEX_ATK_PHASE2 = MakeTexture(COLOR_PHASE2);
            }
            if (!TEX_ATK_PHASE3)
            {
                TEX_ATK_PHASE3 = MakeTexture(COLOR_PHASE3);
            }

            this.spActionsOnHit = this.serializedObject.FindProperty("actionsOnHit");
            if (this.spActionsOnHit.objectReferenceValue == null)
            {
                string actionsName = Guid.NewGuid().ToString("N");

                GameCreatorUtilities.CreateFolderStructure(PATH_ONHIT);
                string path = Path.Combine(PATH_ONHIT, string.Format(PREFAB_NAME, actionsName));
                path = AssetDatabase.GenerateUniqueAssetPath(path);

                GameObject sceneInstance = new GameObject(actionsName);
                sceneInstance.AddComponent <Actions>();

                GameObject prefabInstance = PrefabUtility.SaveAsPrefabAsset(sceneInstance, path);
                DestroyImmediate(sceneInstance);

                Actions prefabActions = prefabInstance.GetComponent <Actions>();
                prefabActions.destroyAfterFinishing      = true;
                this.spActionsOnHit.objectReferenceValue = prefabActions.actionsList;

                this.serializedObject.ApplyModifiedPropertiesWithoutUndo();
                this.serializedObject.Update();
            }

            this.spActionsOnExecute = this.serializedObject.FindProperty("actionsOnExecute");
            if (this.spActionsOnExecute.objectReferenceValue == null)
            {
                string actionsName = Guid.NewGuid().ToString("N");

                GameCreatorUtilities.CreateFolderStructure(PATH_ONHIT);
                string path = Path.Combine(PATH_ONHIT, string.Format(PREFAB_NAME, actionsName));
                path = AssetDatabase.GenerateUniqueAssetPath(path);

                GameObject sceneInstance = new GameObject(actionsName);
                sceneInstance.AddComponent <Actions>();

                GameObject prefabInstance = PrefabUtility.SaveAsPrefabAsset(sceneInstance, path);
                DestroyImmediate(sceneInstance);

                Actions prefabActions = prefabInstance.GetComponent <Actions>();
                prefabActions.destroyAfterFinishing          = true;
                this.spActionsOnExecute.objectReferenceValue = prefabActions.actionsList;

                this.serializedObject.ApplyModifiedPropertiesWithoutUndo();
                this.serializedObject.Update();
            }
        }