Exemple #1
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);
        }
Exemple #2
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;
            string       saveGameName  = StringFieldValue.GetValueA(heroKitObject, 0, true);
            GameSaveData savedGame     = HeroKitCommonRuntime.GetSaveGame(saveGameName);
            string       totalGameplay = "";
            bool         runThis       = (savedGame != null);

            // save the time as a string
            if (runThis)
            {
                // get the time format to use
                string timeFormat = StringFieldValue.GetValueA(heroKitObject, 1);

                // get the start & current date
                TimeSpan timeSpan = new TimeSpan(savedGame.playtimeDays, savedGame.playtimeHours, savedGame.playtimeMinutes, savedGame.playtimeSeconds);

                // create the string
                totalGameplay = String.Format(timeFormat, (int)timeSpan.TotalDays, (int)timeSpan.TotalHours, (int)timeSpan.TotalMinutes, timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds);

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

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

            return(-99);
        }
Exemple #3
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);
        }
Exemple #4
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;

            string valueName = StringFieldValue.GetValueA(heroKitObject, 2);
            int    valueType = DropDownListValue.GetValue(heroKitObject, 0);
            bool   runThis   = (PlayerPrefs.HasKey(valueName));

            if (runThis)
            {
                // integer
                if (valueType == 1)
                {
                    int value = PlayerPrefs.GetInt(valueName);
                    IntegerFieldValue.SetValueB(heroKitObject, 1, value);
                }
                // float
                else if (valueType == 2)
                {
                    float value = PlayerPrefs.GetFloat(valueName);
                    FloatFieldValue.SetValueB(heroKitObject, 1, value);
                }
                // bool
                else if (valueType == 3)
                {
                    int  value    = PlayerPrefs.GetInt(valueName);
                    bool newValue = (value == 0) ? true : false;
                    BoolFieldValue.SetValueB(heroKitObject, 1, newValue);
                }
                // string
                else if (valueType == 4)
                {
                    string value = PlayerPrefs.GetString(valueName);
                    StringFieldValue.SetValueB(heroKitObject, 1, value);
                }
            }
            else
            {
                Debug.LogWarning(valueName + " was not found in player preferences.");
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string debugMessage = "Value Type (1=int, 2=float, 3=bool, 4=string): " + valueType + "\n" +
                                      "Value Name: " + valueName;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }
Exemple #5
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;
            string getThisString = StringFieldValue.GetValueA(heroKitObject, 1);

            StringFieldValue.SetValueB(heroKitObject, 0, getThisString);

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

            return(-99);
        }
Exemple #6
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;

            string productName = Application.productName;

            StringFieldValue.SetValueB(heroKitObject, 0, productName);

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

            return(-99);
        }
Exemple #7
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;

            string sceneName = SceneManager.GetActiveScene().name;

            StringFieldValue.SetValueB(heroKitObject, 0, sceneName);

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

            return(-99);
        }
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            heroKitObject = hko;
            HeroObject heroObject    = HeroObjectFieldValue.GetValueC(heroKitObject, 0);
            string     getThisObject = "";
            bool       runThis       = (heroObject != null);

            if (runThis)
            {
                getThisObject = StringFieldValue.GetValueC(heroKitObject, 1, heroObject);
                StringFieldValue.SetValueB(heroKitObject, 2, getThisObject);
            }

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

            return(-99);
        }
Exemple #9
0
        // Execute the action
        public int Execute(HeroKitObject hko)
        {
            // get values
            heroKitObject = hko;
            string       saveGameName = StringFieldValue.GetValueA(heroKitObject, 0, true);
            GameSaveData savedGame    = HeroKitCommonRuntime.GetSaveGame(saveGameName);
            bool         runThis      = (savedGame != null);

            // save the name of the scene
            if (runThis)
            {
                StringFieldValue.SetValueB(heroKitObject, 1, savedGame.lastScene);
            }

            // debug message
            if (heroKitObject.debugHeroObject)
            {
                string lastScene    = (savedGame != null) ? savedGame.lastScene : "";
                string debugMessage = "Scene: " + lastScene;
                Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage));
            }

            return(-99);
        }