예제 #1
0
        override public ActionEnd End(List <AC.Action> actions)
        {
            if (variableID == -1)
            {
                return(GenerateStopActionEnd());
            }

            GVar compareVar = null;

            if (getVarMethod == GetVarMethod.GlobalVariable || getVarMethod == GetVarMethod.LocalVariable)
            {
                if (compareVariableID == -1)
                {
                    return(GenerateStopActionEnd());
                }

                if (getVarMethod == GetVarMethod.GlobalVariable)
                {
                    compareVar = GlobalVariables.GetVariable(compareVariableID);
                    compareVar.Download();
                }
                else if (getVarMethod == GetVarMethod.LocalVariable && !isAssetFile)
                {
                    compareVar = LocalVariables.GetVariable(compareVariableID, localVariables);
                }
            }

            if (location == VariableLocation.Local && !isAssetFile)
            {
                GVar localVar = LocalVariables.GetVariable(variableID, localVariables);
                if (localVar != null)
                {
                    return(ProcessResult(CheckCondition(localVar, compareVar), actions));
                }

                ACDebug.LogWarning("The 'Variable: Check' Action halted the ActionList because it cannot find the Local Variable with an ID of " + variableID);
                return(GenerateStopActionEnd());
            }
            else
            {
                GVar var = GlobalVariables.GetVariable(variableID);
                if (var != null)
                {
                    var.Download();
                    return(ProcessResult(CheckCondition(var, compareVar), actions));
                }

                ACDebug.LogWarning("The 'Variable: Check' Action halted the ActionList because it cannot find the Global Variable with an ID of " + variableID);
                return(GenerateStopActionEnd());
            }
        }
예제 #2
0
        /**
         * <summary>Returns the value of a global Popup variable.</summary>
         * <param name = "_id">The ID number of the variable</param>
         * <param name = "synchronise">If True, then the variable's value will be synchronised with any external link it may have.</param>
         * <param name = "languageNumber">The index number of the game's current language</param>
         * <returns>The string value of the variable</returns>
         */
        public static string GetPopupValue(int _id, bool synchronise = true, int languageNumber = 0)
        {
            GVar var = GetVariable(_id);

            if (var != null)
            {
                if (synchronise)
                {
                    var.Download();
                }
                return(var.GetValue(languageNumber));
            }

            ACDebug.LogWarning("Variable with ID=" + _id + " not found!");
            return(string.Empty);
        }
예제 #3
0
        /**
         * <summary>Returns the value of a global Vector3 variable.</summary>
         * <param name = "_id">The ID number of the variable</param>
         * <param name = "synchronise">If True, then the variable's value will be synchronised with any external link it may have.</param>
         * <returns>The Vector3 value of the variable</returns>
         */
        public static Vector3 GetVector3Value(int _id, bool synchronise = true)
        {
            GVar var = GetVariable(_id);

            if (var != null)
            {
                if (synchronise)
                {
                    var.Download();
                }
                return(var.vector3Val);
            }

            ACDebug.LogWarning("Variable with ID=" + _id + " not found!");
            return(Vector3.zero);
        }
예제 #4
0
        /**
         * <summary>Returns the value of a global Float variable.</summary>
         * <param name = "_id">The ID number of the variable</param>
         * <param name = "synchronise">If True, then the variable's value will be synchronised with any external link it may have.</param>
         * <returns>The float value of the variable</returns>
         */
        public static float GetFloatValue(int _id, bool synchronise = true)
        {
            GVar var = GetVariable(_id);

            if (var != null)
            {
                if (synchronise)
                {
                    var.Download();
                }
                return(var.floatVal);
            }

            ACDebug.LogWarning("Variable with ID=" + _id + " not found!");
            return(0f);
        }
예제 #5
0
        override public ActionEnd End(List <AC.Action> actions)
        {
            if (variableID == -1)
            {
                return(GenerateStopActionEnd());
            }

            GVar compareVar = null;

            if (getVarMethod == GetVarMethod.GlobalVariable || getVarMethod == GetVarMethod.LocalVariable)
            {
                if (compareVariableID == -1)
                {
                    return(GenerateStopActionEnd());
                }

                if (getVarMethod == GetVarMethod.GlobalVariable)
                {
                    compareVar = GlobalVariables.GetVariable(compareVariableID);
                    compareVar.Download();
                }
                else if (getVarMethod == GetVarMethod.LocalVariable && !isAssetFile)
                {
                    compareVar = LocalVariables.GetVariable(compareVariableID);
                }
            }

            if (location == VariableLocation.Local && !isAssetFile)
            {
                return(ProcessResult(CheckCondition(LocalVariables.GetVariable(variableID), compareVar), actions));
            }

            else
            {
                GVar var = GlobalVariables.GetVariable(variableID);
                if (var != null)
                {
                    var.Download();
                    return(ProcessResult(CheckCondition(var, compareVar), actions));
                }
                return(GenerateStopActionEnd());
            }
        }
예제 #6
0
        /**
         * <summary>Returns the value of a global Boolean variable.<summary>
         * <param name = "_id">The ID number of the variable</param>
         * <param name = "synchronise">If True, then the variable's value will be synchronised with any external link it may have.</param>
         * <returns>The bool value of the variable</returns>
         */
        public static bool GetBooleanValue(int _id, bool synchronise = true)
        {
            GVar var = GetVariable(_id);

            if (var != null)
            {
                if (synchronise)
                {
                    var.Download();
                }

                if (var.val == 1)
                {
                    return(true);
                }
                return(false);
            }

            ACDebug.LogWarning("Variable with ID=" + _id + " not found!");
            return(false);
        }
예제 #7
0
        private void SetVariable(GVar newVar, VariableLocation _newLocation, GVar oldVar)
        {
            if (newVar == null || oldVar == null)
            {
                Debug.LogWarning("Cannot copy variable since it cannot be found!");
                return;
            }

            if (oldLocation == VariableLocation.Global)
            {
                oldVar.Download();
            }

            if (newVar.type == VariableType.Integer || newVar.type == VariableType.Boolean)
            {
                int oldValue = oldVar.val;
                newVar.SetValue(oldValue, SetVarMethod.SetValue);
            }
            else if (newVar.type == VariableType.Float)
            {
                float oldValue = oldVar.floatVal;
                newVar.SetValue(oldValue, AC.SetVarMethod.SetValue);
            }
            else if (newVar.type == VariableType.String)
            {
                string oldValue = oldVar.textVal;
                newVar.SetValue(oldValue);
            }

            if (_newLocation == VariableLocation.Global)
            {
                newVar.Upload();
            }

            KickStarter.actionListManager.VariableChanged();
        }
예제 #8
0
        override public ActionEnd End(List <Action> actions)
        {
            if (numSockets <= 0)
            {
                ACDebug.LogWarning("Could not compute Random check because no values were possible!");
                return(GenerateStopActionEnd());
            }

            if (!saveToVariable)
            {
                int value = ownVarValue;
                ownVarValue++;
                if (ownVarValue >= numSockets)
                {
                    if (doLoop)
                    {
                        ownVarValue = 0;
                    }
                    else
                    {
                        ownVarValue = numSockets - 1;
                    }
                }

                return(ProcessResult(value, actions));
            }

            if (variableID == -1)
            {
                return(GenerateStopActionEnd());
            }

            GVar var = null;

            if (location == VariableLocation.Local && !isAssetFile)
            {
                var = LocalVariables.GetVariable(variableID, localVariables);
            }
            else
            {
                var = GlobalVariables.GetVariable(variableID);
            }

            if (var != null)
            {
                if (var.type == VariableType.Integer)
                {
                    var.Download();
                    if (var.val < 1)
                    {
                        var.val = 1;
                    }
                    int originalValue = var.val - 1;
                    var.val++;
                    if (var.val > numSockets)
                    {
                        if (doLoop)
                        {
                            var.val = 1;
                        }
                        else
                        {
                            var.val = numSockets;
                        }
                    }
                    var.Upload();
                    return(ProcessResult(originalValue, actions));
                }
                else
                {
                    ACDebug.LogWarning("'Variable: Run sequence' Action is referencing a Variable that does not exist or is not an Integer!");
                }
            }

            return(GenerateStopActionEnd());
        }
예제 #9
0
        private void SetVariable(GVar var, VariableLocation location, bool doSkip)
        {
            if (var == null)
            {
                return;
            }

            if (location == VariableLocation.Global)
            {
                var.Download();
            }

            if (var.type == VariableType.Integer)
            {
                int _value = 0;

                if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere)
                {
                    if (setVarMethod == SetVarMethod.Formula)
                    {
                        _value = (int)AdvGame.CalculateFormula(AdvGame.ConvertTokens(formula));
                    }
                    else
                    {
                        _value = intValue;
                    }
                }
                else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter)
                {
                    if (animator && parameterName != "")
                    {
                        _value       = animator.GetInteger(parameterName);
                        setVarMethod = SetVarMethod.SetValue;
                    }
                }

                if (setVarMethod == SetVarMethod.IncreaseByValue && doSkip)
                {
                    var.RestoreBackupValue();
                }

                var.SetValue(_value, setVarMethod);

                if (doSkip)
                {
                    var.BackupValue();
                }
            }
            if (var.type == VariableType.Float)
            {
                float _value = 0;

                if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere)
                {
                    if (setVarMethod == SetVarMethod.Formula)
                    {
                        _value = (float)AdvGame.CalculateFormula(AdvGame.ConvertTokens(formula));
                    }
                    else
                    {
                        _value = floatValue;
                    }
                }
                else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter)
                {
                    if (animator && parameterName != "")
                    {
                        _value       = animator.GetFloat(parameterName);
                        setVarMethod = SetVarMethod.SetValue;
                    }
                }

                if (setVarMethod == SetVarMethod.IncreaseByValue && doSkip)
                {
                    var.RestoreBackupValue();
                }

                var.SetValue(_value, setVarMethod);

                if (doSkip)
                {
                    var.BackupValue();
                }
            }
            else if (var.type == VariableType.Boolean)
            {
                int _value = 0;

                if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere)
                {
                    _value = (int)boolValue;
                }
                else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter)
                {
                    if (animator && parameterName != "")
                    {
                        if (animator.GetBool(parameterName))
                        {
                            _value = 1;
                        }
                    }
                }

                var.SetValue(_value, SetVarMethod.SetValue);
            }
            else if (var.type == VariableType.PopUp)
            {
                var.SetValue(intValue);
            }
            else if (var.type == VariableType.String)
            {
                string _value = "";

                if (setVarMethodString == SetVarMethodString.EnteredHere)
                {
                    _value = AdvGame.ConvertTokens(stringValue);
                }
                else if (setVarMethodString == SetVarMethodString.SetAsMenuElementText)
                {
                    MenuElement menuElement = PlayerMenus.GetElementWithName(menuName, elementName);
                    if (menuElement != null)
                    {
                        if (menuElement is MenuInput)
                        {
                            MenuInput menuInput = (MenuInput)menuElement;
                            _value = menuInput.GetContents();

                            if ((Options.GetLanguageName() == "Arabic" || Options.GetLanguageName() == "Hebrew") && _value.Length > 0)
                            {
                                // Invert
                                char[] charArray = _value.ToCharArray();
                                _value = "";
                                for (int i = charArray.Length - 1; i >= 0; i--)
                                {
                                    _value += charArray[i];
                                }
                            }
                        }
                        else
                        {
                            PlayerMenus.GetMenuWithName(menuName).Recalculate();
                            menuElement.PreDisplay(slotNumber, Options.GetLanguage(), false);
                            _value = menuElement.GetLabel(slotNumber, Options.GetLanguage());
                        }
                    }
                    else
                    {
                        Debug.LogWarning("Could not find MenuInput '" + elementName + "' in Menu '" + menuName + "'");
                    }
                }

                var.SetValue(_value);
            }

            if (location == VariableLocation.Global)
            {
                var.Upload();
            }

            KickStarter.actionListManager.VariableChanged();
        }
예제 #10
0
        private void SetVariable(GVar var, VariableLocation location, bool doSkip)
        {
            if (var == null)
            {
                return;
            }

            if (location == VariableLocation.Global)
            {
                var.Download ();
            }

            if (var.type == VariableType.Integer)
            {
                int _value = 0;

                if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere)
                {
                    if (setVarMethod == SetVarMethod.Formula)
                    {
                        _value = (int) AdvGame.CalculateFormula (AdvGame.ConvertTokens (formula));
                    }
                    else
                    {
                        _value = intValue;
                    }
                }
                else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter)
                {
                    if (animator && parameterName != "")
                    {
                        _value = animator.GetInteger (parameterName);
                        setVarMethod = SetVarMethod.SetValue;
                    }
                }

                if (setVarMethod == SetVarMethod.IncreaseByValue && doSkip)
                {
                    var.RestoreBackupValue ();
                }

                var.SetValue (_value, setVarMethod);

                if (doSkip)
                {
                    var.BackupValue ();
                }
            }
            if (var.type == VariableType.Float)
            {
                float _value = 0;

                if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere)
                {
                    if (setVarMethod == SetVarMethod.Formula)
                    {
                        _value = (float) AdvGame.CalculateFormula (AdvGame.ConvertTokens (formula));
                    }
                    else
                    {
                        _value = floatValue;
                    }
                }
                else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter)
                {
                    if (animator && parameterName != "")
                    {
                        _value = animator.GetFloat (parameterName);
                        setVarMethod = SetVarMethod.SetValue;
                    }
                }

                if (setVarMethod == SetVarMethod.IncreaseByValue && doSkip)
                {
                    var.RestoreBackupValue ();
                }

                var.SetFloatValue (_value, setVarMethod);

                if (doSkip)
                {
                    var.BackupValue ();
                }
            }
            else if (var.type == VariableType.Boolean)
            {
                int _value = 0;

                if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere)
                {
                    _value = (int) boolValue;
                }
                else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter)
                {
                    if (animator && parameterName != "")
                    {
                        if (animator.GetBool (parameterName))
                        {
                            _value = 1;
                        }
                    }
                }

                var.SetValue (_value, SetVarMethod.SetValue);
            }
            else if (var.type == VariableType.PopUp)
            {
                var.SetValue (intValue);
            }
            else if (var.type == VariableType.String)
            {
                string _value = "";

                if (setVarMethodString == SetVarMethodString.EnteredHere)
                {
                    _value = AdvGame.ConvertTokens (stringValue);
                }
                else if (setVarMethodString == SetVarMethodString.SetAsMenuElementText)
                {
                    MenuElement menuElement = PlayerMenus.GetElementWithName (menuName, elementName);
                    if (menuElement != null)
                    {
                        if (menuElement is MenuInput)
                        {
                            MenuInput menuInput = (MenuInput) menuElement;
                            _value = menuInput.GetContents ();

                            if ((Options.GetLanguageName () == "Arabic" || Options.GetLanguageName () == "Hebrew") && _value.Length > 0)
                            {
                                // Invert
                                char[] charArray = _value.ToCharArray ();
                                _value = "";
                                for (int i = charArray.Length-1; i >= 0; i --)
                                {
                                    _value += charArray[i];
                                }
                            }
                        }
                        else
                        {
                            PlayerMenus.GetMenuWithName (menuName).Recalculate ();
                            menuElement.PreDisplay (slotNumber, Options.GetLanguage (), false);
                            _value = menuElement.GetLabel (slotNumber, Options.GetLanguage ());
                        }
                    }
                    else
                    {
                        Debug.LogWarning ("Could not find MenuInput '" + elementName + "' in Menu '" + menuName + "'");
                    }
                }

                var.SetStringValue (_value);
            }

            if (location == VariableLocation.Global)
            {
                var.Upload ();
            }

            KickStarter.actionListManager.VariableChanged ();
        }
예제 #11
0
        private void SetVariable(GVar newVar, VariableLocation _newLocation, GVar oldVar)
        {
            if (newVar == null || oldVar == null)
            {
                ACDebug.LogWarning ("Cannot copy variable since it cannot be found!");
                return;
            }

            if (oldLocation == VariableLocation.Global)
            {
                oldVar.Download ();
            }

            if (newVar.type == VariableType.Integer || newVar.type == VariableType.Boolean)
            {
                int oldValue = oldVar.val;
                newVar.SetValue (oldValue, SetVarMethod.SetValue);
            }
            else if (newVar.type == VariableType.Float)
            {
                float oldValue = oldVar.floatVal;
                newVar.SetFloatValue (oldValue, AC.SetVarMethod.SetValue);
            }
            else if (newVar.type == VariableType.String)
            {
                string oldValue = oldVar.textVal;
                newVar.SetStringValue (oldValue);
            }

            if (_newLocation == VariableLocation.Global)
            {
                newVar.Upload ();
            }

            KickStarter.actionListManager.VariableChanged ();
        }
예제 #12
0
        /**
         * <summary>Copies the value of another variable onto itself.</summary>
         * <param name = "oldVar">The variable to copy from</param>
         * <param name = "oldLocation">The location of the variable to copy (Global, Local)</param>
         */
        public void CopyFromVariable(GVar oldVar, VariableLocation oldLocation)
        {
            if (oldLocation == VariableLocation.Global)
            {
                oldVar.Download();
            }

            if (type == VariableType.Integer || type == VariableType.Boolean || type == VariableType.PopUp)
            {
                int oldValue = oldVar.val;

                if (oldVar.type == VariableType.Float)
                {
                    oldValue = (int)oldVar.floatVal;
                }
                else if (oldVar.type == VariableType.String)
                {
                    float oldValueAsFloat = 0f;
                    float.TryParse(oldVar.textVal, out oldValueAsFloat);
                    oldValue = (int)oldValueAsFloat;
                }

                if (type == VariableType.PopUp && oldVar.HasTranslations())
                {
                    runtimeTranslations = oldVar.GetTranslations();
                }
                else
                {
                    runtimeTranslations = null;
                }

                SetValue(oldValue, SetVarMethod.SetValue);
            }
            else if (type == VariableType.Float)
            {
                float oldValue = oldVar.floatVal;

                if (oldVar.type == VariableType.Integer || oldVar.type == VariableType.Boolean || oldVar.type == VariableType.PopUp)
                {
                    oldValue = (float)oldVar.val;
                }
                else if (oldVar.type == VariableType.String)
                {
                    float.TryParse(oldVar.textVal, out oldValue);
                }

                SetFloatValue(oldValue, AC.SetVarMethod.SetValue);
            }
            else if (type == VariableType.String)
            {
                string oldValue = oldVar.GetValue();
                textVal = oldValue;

                if (oldVar.HasTranslations())
                {
                    runtimeTranslations = oldVar.GetTranslations();
                }
                else
                {
                    runtimeTranslations = null;
                }
            }
            else if (type == VariableType.Vector3)
            {
                Vector3 oldValue = oldVar.vector3Val;
                vector3Val = oldValue;
            }
        }
예제 #13
0
파일: GVar.cs 프로젝트: cvkumar/out-of-body
        /**
         * <summary>Copies the value of another variable onto itself.</summary>
         * <param name = "oldVar">The variable to copy from</param>
         * <param name = "oldLocation">The location of the variable to copy (Global, Local)</param>
         */
        public void CopyFromVariable(GVar oldVar, VariableLocation oldLocation)
        {
            if (oldLocation == VariableLocation.Global)
            {
                oldVar.Download(oldLocation);
            }

            switch (type)
            {
            case VariableType.Float:
            {
                float oldValue = oldVar.FloatValue;

                if (oldVar.type == VariableType.Integer || oldVar.type == VariableType.Boolean || oldVar.type == VariableType.PopUp)
                {
                    oldValue = (float)oldVar.IntegerValue;
                }
                else if (oldVar.type == VariableType.String)
                {
                    float.TryParse(oldVar.textVal, out oldValue);
                }

                FloatValue = oldValue;
                break;
            }

            case VariableType.String:
            {
                string oldValue = oldVar.GetValue();
                textVal = oldValue;

                if (oldVar.HasTranslations())
                {
                    runtimeTranslations = oldVar.GetTranslations();
                }
                else
                {
                    runtimeTranslations = null;
                }
                break;
            }

            case VariableType.Vector3:
            {
                Vector3 oldValue = oldVar.vector3Val;
                Vector3Value = oldValue;
                break;
            }

            default:
            {
                int oldValue = oldVar.val;

                if (oldVar.type == VariableType.Float)
                {
                    oldValue = (int)oldVar.floatVal;
                }
                else if (oldVar.type == VariableType.String)
                {
                    float oldValueAsFloat = 0f;
                    float.TryParse(oldVar.textVal, out oldValueAsFloat);
                    oldValue = (int)oldValueAsFloat;
                }

                if (type == VariableType.PopUp && oldVar.HasTranslations())
                {
                    runtimeTranslations = oldVar.GetTranslations();
                }
                else
                {
                    runtimeTranslations = null;
                }

                IntegerValue = oldValue;
                break;
            }
            }
        }
예제 #14
0
		private void SetVariable (GVar var, VariableLocation location)
		{
			if (var == null)
			{
				return;
			}

			if (location == VariableLocation.Global)
			{
				var.Download ();
			}

			if (var.type == VariableType.Integer)
			{
				int _value = 0;

				if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere)
				{
					if (setVarMethod == SetVarMethod.Formula)
					{
						_value = (int) AdvGame.CalculateFormula (AdvGame.ConvertTokens (formula));
					}
					else
					{
						_value = intValue;
					}
				}
				else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter)
				{
					if (animator && parameterName != "")
					{
						_value = animator.GetInteger (parameterName);
						setVarMethod = SetVarMethod.SetValue;
					}	
				}

				var.SetValue (_value, setVarMethod);
			}
			if (var.type == VariableType.Float)
			{
				float _value = 0;
				
				if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere)
				{
					if (setVarMethod == SetVarMethod.Formula)
					{
						_value = (float) AdvGame.CalculateFormula (AdvGame.ConvertTokens (formula));
					}
					else
					{
						_value = floatValue;
					}
				}
				else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter)
				{
					if (animator && parameterName != "")
					{
						_value = animator.GetFloat (parameterName);
						setVarMethod = SetVarMethod.SetValue;
					}	
				}
				
				var.SetValue (_value, setVarMethod);
			}
			else if (var.type == VariableType.Boolean)
			{
				int _value = 0;

				if (setVarMethodIntBool == SetVarMethodIntBool.EnteredHere)
				{
					_value = (int) boolValue;
				}
				else if (setVarMethodIntBool == SetVarMethodIntBool.SetAsMecanimParameter)
				{
					if (animator && parameterName != "")
					{
						if (animator.GetBool (parameterName))
						{
							_value = 1;
						}
					}
				}

				var.SetValue (_value, SetVarMethod.SetValue);
			}
			else if (var.type == VariableType.PopUp)
			{
				var.SetValue (intValue);
			}
			else if (var.type == VariableType.String)
			{
				string _value = "";

				if (setVarMethodString == SetVarMethodString.EnteredHere)
				{
					_value = AdvGame.ConvertTokens (stringValue);
				}
				else if (setVarMethodString == SetVarMethodString.SetAsMenuInputLabel)
				{
					if (PlayerMenus.GetElementWithName (menuName, elementName) != null)
					{
						MenuInput menuInput = (MenuInput) PlayerMenus.GetElementWithName (menuName, elementName);
						_value = menuInput.label;

						if ((Options.GetLanguageName () == "Arabic" || Options.GetLanguageName () == "Hebrew") && _value.Length > 0)
						{
							// Invert
							char[] charArray = _value.ToCharArray ();
							_value = "";
							for (int i = charArray.Length-1; i >= 0; i --)
							{
								_value += charArray[i];
							}
						}
					}
					else
					{
						Debug.LogWarning ("Could not find MenuInput '" + elementName + "' in Menu '" + menuName + "'");
					}
				}

				var.SetValue (_value);
			}

			if (location == VariableLocation.Global)
			{
				var.Upload ();
			}

			GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>().VariableChanged ();
		}
예제 #15
0
		private void SetVariable (GVar newVar, VariableLocation _newLocation, GVar oldVar)
		{
			if (newVar == null || oldVar == null)
			{
				return;
			}

			if (oldLocation == VariableLocation.Global)
			{
				oldVar.Download ();
			}

			if (newVar.type == VariableType.Integer || newVar.type == VariableType.Boolean)
			{
				int oldValue = oldVar.val;
				newVar.SetValue (oldValue, SetVarMethod.SetValue);
			}
			else if (newVar.type == VariableType.Float)
			{
				float oldValue = oldVar.floatVal;
				newVar.SetValue (oldValue, AC.SetVarMethod.SetValue);
			}
			else if (newVar.type == VariableType.String)
			{
				string oldValue = oldVar.textVal;
				newVar.SetValue (oldValue);
			}

			if (_newLocation == VariableLocation.Global)
			{
				newVar.Upload ();
			}

			GameObject.FindWithTag (Tags.gameEngine).GetComponent <ActionListManager>().VariableChanged ();
		}