Esempio n. 1
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // add menu to scene if it doesn't exist
            HeroKitObject targetObject = HeroKitCommonRuntime.GetPrefabFromAssets(HeroKitCommonRuntime.settingsInfo.inventoryMenu, true);
            HeroObject    item         = null;
            int           count        = 0;
            bool          runThis      = (targetObject != null);

            if (runThis)
            {
                targetObject.gameObject.name = HeroKitCommonRuntime.settingsInfo.inventoryMenu.name;
                targetObject.gameObject.SetActive(true);

                // get the container for the inventory slots
                GameObject parent = HeroKitCommonRuntime.GetChildGameObject(targetObject.gameObject, "Inventory Menu Content");
                if (parent != null)
                {
                    // get the item we want to remove
                    item = HeroObjectFieldValue.GetValueC(heroKitObject, 0);
                    if (item != null)
                    {
                        // get the number of items to remove
                        bool addMultiple = BoolValue.GetValue(heroKitObject, 1);
                        count = (addMultiple) ? IntegerFieldValue.GetValueA(heroKitObject, 2) : 1;

                        // check to see if the inventory slot already exists in the menu
                        GameObject    gameObject = HeroKitCommonRuntime.GetChildGameObject(parent, item.name, false);
                        HeroKitObject heroObject = null;

                        // if the item exists, remove it
                        if (gameObject != null)
                        {
                            // get hero kit object
                            if (heroObject == null)
                            {
                                heroObject = heroKitObject.GetGameObjectComponent <HeroKitObject>("HeroKitObject", false, gameObject);
                            }

                            // add the # of items to add to integer variable list, slot 1
                            heroObject.heroList.ints.items[1].value = count;

                            // play event 2 in the hero kit object attached to this prefab
                            heroObject.PlayEvent(2);
                        }
                    }
                }
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Item: " + item + "\n" +
                                      "Count: " + count;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 2
0
        // Check to see if an integer meets certain conditions in an if statement
        // This is used by both If and Else If
        public int Execute(HeroKitObject hko)
        {
            // assign variables
            heroKitObject = hko;
            eventID       = heroKitObject.heroStateData.eventBlock;
            int actionID      = heroKitObject.heroStateData.action;
            int currentIndent = heroKitObject.heroState.heroEvent[eventID].actions[actionID].indent;

            // evaluate the if statement
            int   comparison = DropDownListValue.GetValue(heroKitObject, 2);
            float value1     = FloatFieldValue.GetValueB(heroKitObject, 1);
            float value2     = FloatFieldValue.GetValueA(heroKitObject, 3);
            bool  evaluation = HeroActionCommonRuntime.CompareFloats(comparison, value1, value2);

            // next we need to get the action that we want the game loop to think just executed
            // this checks to see if the if statement should be run
            // if it should run, it disables the next conditional action if it is "Else" or "Else If"
            int thisAction = HeroActionCommonRuntime.RunConditionalIfAction(heroKitObject, eventID, actionID, currentIndent, evaluation);

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Float A: " + value1 + "\n" +
                                      "Float B: " + value2 + "\n" +
                                      "Result: " + evaluation;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            // return the action that we want the game loop to think just executed
            return(thisAction);
        }
Esempio n. 3
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            GameObject menuTemplate = PrefabValue.GetValue(heroKitObject, 0);
            bool       runThis      = (menuTemplate != null);

            if (runThis)
            {
                // if new prefab is not in scene, delete the old one from scene and attach new prefab to settings.
                GameObject prefab = HeroKitCommonRuntime.settingsInfo.dialogBox;
                if (prefab != null && prefab != menuTemplate)
                {
                    HeroKitCommonRuntime.DeletePrefabFromScene(prefab, true);
                    HeroKitCommonRuntime.settingsInfo.dialogBox = menuTemplate;
                }
            }

            if (heroKitObject.debugHeroObject)
            {
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject));
            }

            return(-99);
        }
Esempio n. 4
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get the hero object where the parameters are stored
            HeroKitObject[]  targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            UnityObjectField objectData   = UnityObjectFieldValue.GetValueA(heroKitObject, 2);
            string           scriptName   = (objectData.value != null) ? objectData.value.name : "";
            MethodInfo       method       = MethodValue.GetValue(heroKitObject, 3);

            string[] debugInfo = new string[targetObject.Length];
            bool     runThis   = (targetObject != null && scriptName != "" && method != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                debugInfo[i] = ExecuteOnTarget(targetObject[i], scriptName, method);
            }


            //------------------------------------
            // debug message
            //------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string strDebugInfo = (debugInfo != null && debugInfo.Length > 0) ? debugInfo[0] : "";
                string debugMessage = "MonoScript: " + scriptName + "\n" +
                                      "Method: " + method + "\n" +
                                      "Parameters: " + strDebugInfo;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 5
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            string          childName    = ChildObjectValue.GetValue(heroKitObject, 2, 3);
            bool            runThis      = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], childName);
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Child (if used): " + childName + "\n" +
                                      "Position to Change: " + position;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 6
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            SceneObjectValueData data = SceneObjectValue.GetValue(heroKitObject, 0, 1, false);

            GameObject[] targetObject = HeroKitCommonRuntime.GetGameObjectsFromSceneObjects(data);
            bool         runThis      = (targetObject != null && targetObject.Length > 0);

            // get value from first game object in list
            if (runThis)
            {
                StringFieldValue.SetValueB(heroKitObject, 2, targetObject[0].name);
            }

            // debug info
            if (heroKitObject.debugHeroObject)
            {
                string strName      = (targetObject != null && targetObject.Length > 0 && targetObject[0] != null) ? targetObject[0].name : "";
                string debugMessage = "Name: " + strName;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 7
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            float           speed        = FloatFieldValue.GetValueA(heroKitObject, 2);

            if (speed < 0)
            {
                speed = 0;
            }
            bool runThis = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], speed);
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Move Speed: " + speed;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 8
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            Vector3         degrees      = new Vector3();

            degrees.z = DropDownListValue.GetValue(heroKitObject, 2);
            int  speed   = IntegerFieldValue.GetValueA(heroKitObject, 3);
            bool runThis = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], speed, degrees);
            }

            // set up update for long action
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = false;
            updateIsDone = false;
            heroKitObject.longActions.Add(this);

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Speed: " + speed + "\n" +
                                      "Euler Angles: " + degrees;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 9
0
        // execute this action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            string          childName    = ChildObjectValue.GetValue(heroKitObject, 2, 3);
            int             colliderType = DropDownListValue.GetValue(heroKitObject, 4);
            bool            runThis      = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], childName, colliderType);
            }

            //-----------------------------------------
            // debugging stuff
            //-----------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject));
            }

            // return value
            return(-99);
        }
Esempio n. 10
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            HeroKitObject[] targetObject    = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            bool            changePrefab    = BoolValue.GetValue(heroKitObject, 2);
            GameObject      prefab          = (changePrefab) ? PrefabValue.GetValue(heroKitObject, 3) : null;
            bool            changeRigidbody = BoolValue.GetValue(heroKitObject, 4);
            Rigidbody       rigidbody       = (changeRigidbody) ? RigidbodyValue.GetValue(heroKitObject, 5) : null;
            bool            changeHidden    = BoolValue.GetValue(heroKitObject, 6);
            int             isHidden        = (changeHidden) ? DropDownListValue.GetValue(heroKitObject, 7) : 0;

            bool runThis = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], changePrefab, prefab, changeRigidbody, rigidbody, changeHidden, isHidden);
            }

            // show debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Result: " + prefab + " " + rigidbody;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 11
0
        // execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get the hero object where the parameters are stored
            HeroKitObject    targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1)[0];
            UnityObjectField objectData   = UnityObjectFieldValue.GetValueA(heroKitObject, 2);
            string           scriptName   = (objectData.value != null) ? objectData.value.name : "";

            bool runThis = (targetObject != null && scriptName != "");

            if (runThis)
            {
                ExecuteOnTarget(targetObject, scriptName);
            }

            //------------------------------------
            // debug message
            //------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "MonoScript: " + scriptName + "\n" +
                                      "Hero Kit Object: " + targetObject;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 12
0
        //--------------------------------------------------
        // SECTION C
        //--------------------------------------------------

        // Pauses an event for X amount of time before going on to the next action
        public int Execute(HeroKitObject hko)
        {
            // assign variables (don't change)
            heroKitObject = hko;

            // replace this part with with your fields & code
            int secondsToWait = IntegerFieldValue.GetValueA(heroKitObject, 0);

            timeToWait = secondsToWait + Time.time;

            // set up update for long action (don't change)
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = true;
            updateIsDone = false;
            heroKitObject.longActions.Add(this); // if you want to update this action using FixedUpdate, change longActions to longActionsFixed

            // show debug message for this action (add a custom message if desired or delete the custom message).
            if (heroKitObject.debugHeroObject)
            {
                string customMessage = "Seconds to wait: " + secondsToWait;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, customMessage));
            }

            // the return code (don't change)
            return(-99);
        }
Esempio n. 13
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            SceneObjectValueData data = SceneObjectValue.GetValue(heroKitObject, 0, 1, false);
            string childName          = ChildObjectValue.GetValue(heroKitObject, 2, 3);
            string componentName      = StringFieldValue.GetValueA(heroKitObject, 4);

            // get the game object to work with
            GameObject[] targetObject = HeroKitCommonRuntime.GetGameObjectsFromSceneObjects(data);
            bool         runThis      = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], childName, componentName);
            }

            // debug info
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Component: " + componentName + "\n" +
                                      "Child (if updating component on child): " + childName;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 14
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;
            HeroKitObject[] targetObject  = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            string          animationName = AnimationParameterValue.GetValueA(heroKitObject, 2, 3, 4);
            bool            runThis       = (animationName != "" && targetObject != null);

            if (runThis)
            {
                // set up long data for animations
                animInfo = new LegacyAnimationInfo[targetObject.Length];

                // execute action for all objects in list
                for (int i = 0; runThis && i < targetObject.Length; i++)
                {
                    ExecuteOnTarget(targetObject[i], animationName, i);
                }
            }

            // set up the long action
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = true;
            updateIsDone = false;
            heroKitObject.longActions.Add(this);

            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = animationName + ": " + "on";
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 15
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            GameObject    prefab          = PrefabValue.GetValue(heroKitObject, 0);
            GameObject    parent          = GameObjectFieldValue.GetValueA(heroKitObject, 1);
            int           count           = IntegerFieldValue.GetValueA(heroKitObject, 2);
            bool          incrementItemID = BoolValue.GetValue(heroKitObject, 3);
            HeroKitObject notifications   = HeroObjectFieldValue.GetValueA(heroKitObject, 4)[0];
            int           stateID         = EventValue.GetStateID(heroKitObject, 5);
            int           eventID         = EventValue.GetEventID(heroKitObject, 5);
            bool          runThis         = (prefab != null && parent != null);

            if (runThis)
            {
                CreateUIObjects(prefab, parent, count, incrementItemID, notifications, stateID, eventID, false);
            }

            //------------------------------------
            // debug message
            //------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Parent Game Object: " + parent + "\n" +
                                      "Object to Duplicate: " + prefab + "\n" +
                                      "Number of Duplicates: " + count + "\n" +
                                      "Increment Item ID: " + incrementItemID + "\n" +
                                      "Send Notifications Here: " + notifications + "\n" +
                                      "Notification State ID: " + stateID + "\n" +
                                      "Notification Event ID: " + eventID;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 16
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;
            HeroKitObject[] targetObject   = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            float           jumpHeight     = FloatFieldValue.GetValueA(heroKitObject, 2);
            int             jumpDirection  = DropDownListValue.GetValue(heroKitObject, 3);
            int             directionForce = (jumpDirection > 1) ? IntegerFieldValue.GetValueA(heroKitObject, 4) : 0;

            wait = !BoolValue.GetValue(heroKitObject, 5);
            bool runThis = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], jumpHeight, jumpDirection, directionForce);
            }

            // set up the long action
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = wait;
            updateIsDone = false;
            heroKitObject.longActions.Add(this);

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Force: " + jumpHeight;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 17
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            SceneObjectValueData data = SceneObjectValue.GetValue(heroKitObject, 0, 1, false);

            GameObject[] targetObject = HeroKitCommonRuntime.GetGameObjectsFromSceneObjects(data);
            string       tag          = TagValue.GetValue(heroKitObject, 2);
            bool         runThis      = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], tag);
            }

            // debug info
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Tag: " + tag;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 18
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            float           duration     = FloatFieldValue.GetValueA(heroKitObject, 2);
            bool            runThis      = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], duration);
            }

            // set up update for long action
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = true;
            updateIsDone = false;
            heroKitObject.longActionsFixed.Add(this);

            // show debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Duration: " + duration;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 19
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            float           timeToWait   = FloatFieldValue.GetValueA(heroKitObject, 2) + Time.time;
            float           speed        = FloatFieldValue.GetValueA(heroKitObject, 3);

            wait = !BoolValue.GetValue(heroKitObject, 4);
            bool runThis = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], timeToWait, speed);
            }

            // set up update for long action
            heroKitObject.heroState.heroEvent[eventID].waiting = wait;
            updateIsDone = false;
            heroKitObject.longActions.Add(this);

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Speed: " + speed;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 20
0
        // execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get the hero object where the parameters are stored
            HeroKitObject[]  targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            UnityObjectField objectData   = UnityObjectFieldValue.GetValueA(heroKitObject, 2);
            string           scriptName   = (objectData.value != null) ? objectData.value.name : "";
            bool             runThis      = (targetObject != null && scriptName != "");

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], scriptName);
            }

            //------------------------------------
            // debug message
            //------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "MonoScript: " + scriptName;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 21
0
        //--------------------------------------------------
        // SECTION C
        //--------------------------------------------------

        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // assign values (don't change)
            heroKitObject = hko;

            // replace this part with with your fields & code
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            bool            boolValue    = BoolFieldValue.GetValueA(heroKitObject, 3);

            // check to see if we can run this action on one or more hero game objects (don't change if this action can be used on more than one hero game object).
            bool runThis = (targetObject != null);

            // execute action for all objects in list (don't change if this action can be used on more than one hero game object).
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], boolValue);
            }

            // show debug message for this action (add a custom message if desired or delete the custom message).
            if (hko.debugHeroObject)
            {
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, "custom message"));
            }

            // the return code (don't change)
            return(-99);
        }
Esempio n. 22
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;
            string saveGameName = StringFieldValue.GetValueA(heroKitObject, 0, true);
            string path         = Application.persistentDataPath + "/HeroSaves/" + saveGameName + ".json";
            string date         = "";
            bool   runThis      = (File.Exists(path));

            // get the json data in the file
            if (runThis)
            {
                DateTime saveDate = File.GetLastWriteTime(path);

                // get the date format to use
                string dateFormat = StringFieldValue.GetValueA(heroKitObject, 1);

                // get the date
                date = saveDate.ToString(dateFormat);

                // save the date
                StringFieldValue.SetValueB(heroKitObject, 2, date);
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Save Game Date: " + date + "\n" +
                                      "Save Game Name: " + saveGameName;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 23
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;
            HeroKitObject[]  targetObject   = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            UnityObjectField unityObject    = UnityObjectFieldValue.GetValueA(heroKitObject, 2);
            AudioClip        audioClip      = (unityObject.value != null) ? (AudioClip)unityObject.value : null;
            bool             changeSettings = BoolValue.GetValue(heroKitObject, 3);
            bool             runThis        = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], audioClip, changeSettings);
            }

            // show debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "BGM: " + audioClip;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 24
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // get field values
            GameObject targetObject = GameObjectFieldValue.GetValueA(heroKitObject, 0);
            bool       runThis      = (targetObject != null);

            if (runThis)
            {
                // turn game object off
                targetObject.SetActive(true);
            }

            //------------------------------------
            // debug message
            //------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Game Object: " + targetObject;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 25
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            string           title        = StringFieldValue.GetValueA(heroKitObject, 0);
            ShowSaveGameMenu showMenu     = new ShowSaveGameMenu();
            HeroKitObject    targetObject = showMenu.SetupSaveMenu(title, 2);
            bool             runThis      = (targetObject != null);

            if (runThis)
            {
                // menu was called from start menu
                bool calledFromStartMenu = BoolValue.GetValue(heroKitObject, 1);
                targetObject.heroList.bools.items[1].value = calledFromStartMenu;

                // enable the canvas
                Canvas canvas = targetObject.GetHeroComponent <Canvas>("Canvas");
                canvas.enabled = true;
            }

            if (heroKitObject.debugHeroObject)
            {
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject));
            }

            return(-99);
        }
Esempio n. 26
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            // add menu to scene if it doesn't exist
            HeroKitObject targetObject = HeroKitCommonRuntime.GetPrefabFromAssets(HeroKitCommonRuntime.settingsInfo.optionsMenu, true);
            bool          runThis      = (targetObject != null);

            if (runThis)
            {
                targetObject.gameObject.SetActive(true);

                // menu was called from start menu
                bool calledFromStartMenu = BoolValue.GetValue(heroKitObject, 0);
                targetObject.heroList.bools.items[1].value = calledFromStartMenu;

                // enable the canvas
                Canvas canvas = targetObject.GetHeroComponent <Canvas>("Canvas");
                canvas.enabled = true;
            }

            if (heroKitObject.debugHeroObject)
            {
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject));
            }

            return(-99);
        }
Esempio n. 27
0
        // Gets objects in a scene that match a certerin criteria
        public int Execute(HeroKitObject hko)
        {
            // Get variables
            heroKitObject = hko;

            //-----------------------------------------
            // Get the game objects in the scene that match specific parameters
            //-----------------------------------------
            int actionType     = DropDownListValue.GetValue(heroKitObject, 0);
            int getHeroFieldID = 1;
            int objectCount    = IntegerFieldValue.GetValueA(heroKitObject, 2);
            int heroGuid       = IntegerFieldValue.GetValueA(heroKitObject, 3);

            // filter the hero kit objects in the scene
            List <HeroKitObject> filteredObjects = HeroActionCommonRuntime.GetHeroObjectsByGUID(HeroActionCommonRuntime.GetHeroObjectsInScene(), objectCount, heroGuid);

            // assign the hero kit objects to the list
            HeroActionCommonRuntime.AssignObjectsToList(heroKitObject, getHeroFieldID, filteredObjects, actionType);

            //-----------------------------------------
            // debugging stuff
            //-----------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string countStr     = (filteredObjects != null) ? filteredObjects.Count.ToString() : 0.ToString();
                string debugMessage = "Get objects with this GUID: " + heroGuid + "\n" +
                                      "Maximum number of objects to get: " + objectCount + "\n" +
                                      "Objects found: " + countStr;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 28
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;

            HeroKitObject[] targetObject    = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            bool            changeStartAnim = BoolValue.GetValue(heroKitObject, 2);
            bool            changeEndAnim   = BoolValue.GetValue(heroKitObject, 6);
            bool            runThis         = (targetObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], changeStartAnim, changeEndAnim);
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string jumpBegin    = (moveObject != null) ? moveObject.animationJumpBegin : "";
                string jumpEnd      = (moveObject != null) ? moveObject.animationJumpEnd : "";
                string debugMessage = "Jump Begin Animation: " + jumpBegin + "\n" +
                                      "Jump End Animation: " + jumpEnd;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 29
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;
            HeroKitObject[] targetObject = HeroObjectFieldValue.GetValueE(heroKitObject, 0, 1);
            HeroKitObject   avoidObject  = HeroObjectFieldValue.GetValueA(heroKitObject, 2)[0];
            bool            runThis      = (targetObject != null && avoidObject != null);

            // execute action for all objects in list
            for (int i = 0; runThis && i < targetObject.Length; i++)
            {
                ExecuteOnTarget(targetObject[i], avoidObject);
            }

            // set up the long action
            eventID = heroKitObject.heroStateData.eventBlock;
            heroKitObject.heroState.heroEvent[eventID].waiting = true;
            updateIsDone = false;
            heroKitObject.longActions.Add(this);

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Object to avoid: " + avoidObject;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Esempio n. 30
0
        // Gets objects in a scene that match a certerin criteria
        public int Execute(HeroKitObject hko)
        {
            // Get variables
            heroKitObject = hko;
            eventID       = hko.heroStateData.eventBlock;

            // get the source object
            GameObject    sourceGameObject = heroKitObject.heroState.heroEvent[eventID].messenger;
            HeroKitObject sourceHeroObject = null;
            bool          runThis          = (sourceGameObject != null);

            // get the hero object
            if (runThis)
            {
                sourceHeroObject = heroKitObject.GetGameObjectComponent <HeroKitObject>("HeroKitObject", false, sourceGameObject);
                List <HeroKitObject> heroObjectList = new List <HeroKitObject>();
                heroObjectList.Add(sourceHeroObject);

                // save hero object
                HeroObjectFieldValue.SetValueB(heroKitObject, 0, heroObjectList);
            }

            //-----------------------------------------
            // debugging stuff
            //-----------------------------------------
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Hero Object: " + sourceHeroObject;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }