示例#1
0
        private GVar GetVariable()
        {
            GVar var = null;

            if (location == VariableLocation.Local && !isAssetFile)
            {
                var = LocalVariables.GetVariable(variableID);
            }
            else
            {
                if (Application.isPlaying)
                {
                    var = GlobalVariables.GetVariable(variableID);
                }
                else if (AdvGame.GetReferences().variablesManager)
                {
                    var = AdvGame.GetReferences().variablesManager.GetVariable(variableID);
                }
            }

            if (var != null && var.type == VariableType.PopUp)
            {
                return(var);
            }

            return(null);
        }
        override public float Run()
        {
            if (newVariableID != -1 && oldVariableID != -1)
            {
                GVar oldVar;
                if (oldLocation == VariableLocation.Global)
                {
                    oldVar = GlobalVariables.GetVariable(oldVariableID);
                }
                else
                {
                    oldVar = LocalVariables.GetVariable(oldVariableID);
                }

                if (newLocation == VariableLocation.Local && !isAssetFile)
                {
                    SetVariable(LocalVariables.GetVariable(newVariableID), VariableLocation.Local, oldVar);
                }
                else
                {
                    SetVariable(GlobalVariables.GetVariable(newVariableID), VariableLocation.Global, oldVar);
                }
            }

            return(0f);
        }
        override public void AssignValues(List <ActionParameter> parameters)
        {
            runtimeObToRead = AssignFile(parameters, obToReadParameterID, obToReadConstantID, obToRead);

            runtimeVariable = null;
            switch (variableLocation)
            {
            case VariableLocation.Global:
                variableID      = AssignVariableID(parameters, variableParameterID, variableID);
                runtimeVariable = GlobalVariables.GetVariable(variableID, true);
                break;

            case VariableLocation.Local:
                if (!isAssetFile)
                {
                    variableID      = AssignVariableID(parameters, variableParameterID, variableID);
                    runtimeVariable = LocalVariables.GetVariable(variableID, localVariables);
                }
                break;

            case VariableLocation.Component:
                runtimeVariables = AssignFile <Variables> (variablesConstantID, variables);
                if (runtimeVariables != null)
                {
                    runtimeVariable = runtimeVariables.GetVariable(variableID);
                }
                runtimeVariable  = AssignVariable(parameters, variableParameterID, runtimeVariable);
                runtimeVariables = AssignVariablesComponent(parameters, variableParameterID, runtimeVariables);
                break;
            }
        }
        public override void AssignValues(List <ActionParameter> parameters)
        {
            invID = AssignInvItemID(parameters, invParameterID, invID);

            runtimeVariable = null;
            switch (varLocation)
            {
            case VariableLocation.Global:
                variableID      = AssignVariableID(parameters, varParameterID, variableID);
                runtimeVariable = GlobalVariables.GetVariable(variableID, true);
                break;

            case VariableLocation.Local:
                if (!isAssetFile)
                {
                    variableID      = AssignVariableID(parameters, varParameterID, variableID);
                    runtimeVariable = LocalVariables.GetVariable(variableID, localVariables);
                }
                break;

            case VariableLocation.Component:
                Variables runtimeVariables = AssignFile <Variables> (variablesConstantID, variables);
                if (runtimeVariables != null)
                {
                    runtimeVariable = runtimeVariables.GetVariable(variableID);
                }
                runtimeVariable = AssignVariable(parameters, varParameterID, runtimeVariable);
                break;
            }
        }
        override public ActionEnd End(List <AC.Action> actions)
        {
            if (_parameter == null)
            {
                return(GenerateStopActionEnd());
            }

            GVar    compareVar  = null;
            InvItem compareItem = null;

            if (_parameter.parameterType == ParameterType.GlobalVariable || _parameter.parameterType == ParameterType.LocalVariable || _parameter.parameterType == ParameterType.InventoryItem)
            {
                if (compareVariableID == -1)
                {
                    return(GenerateStopActionEnd());
                }

                if (_parameter.parameterType == ParameterType.GlobalVariable)
                {
                    compareVar = GlobalVariables.GetVariable(compareVariableID);
                    compareVar.Download();
                }
                else if (_parameter.parameterType == ParameterType.LocalVariable && !isAssetFile)
                {
                    compareVar = LocalVariables.GetVariable(compareVariableID);
                }
                else if (_parameter.parameterType == ParameterType.InventoryItem)
                {
                    compareItem = KickStarter.runtimeInventory.GetItem(compareVariableID);
                }
            }

            return(ProcessResult(CheckCondition(compareItem, compareVar), actions));
        }
示例#6
0
        /**
         * <summary>Gets the display text of the element.</summary>
         * <param name = "slot">Ignored by this subclass</param>
         * <param name = "languageNumber">The index number of the language number to get the text in</param>
         * <returns>The display text of the element</returns>
         */
        public override string GetLabel(int slot, int languageNumber)
        {
            if (labelType == AC_LabelType.Normal)
            {
                return(TranslateLabel(label, languageNumber));
            }
            else if (labelType == AC_LabelType.DialogueSpeaker)
            {
                return(KickStarter.dialog.GetSpeaker(languageNumber));
            }
            else if (labelType == AC_LabelType.GlobalVariable)
            {
                return(GlobalVariables.GetVariable(variableID).GetValue(languageNumber));
            }
            else if (labelType == AC_LabelType.Hotspot)
            {
                return(newLabel);
            }
            else if (labelType == AC_LabelType.ActiveSaveProfile)
            {
                if (Application.isPlaying)
                {
                    return(KickStarter.options.GetProfileName());
                }
                else
                {
                    return(label);
                }
            }

            return("");
        }
示例#7
0
        public override void AssignValues(List <ActionParameter> parameters)
        {
            intValue     = AssignInteger(parameters, checkParameterID, intValue);
            boolValue    = AssignBoolean(parameters, checkParameterID, boolValue);
            floatValue   = AssignFloat(parameters, checkParameterID, floatValue);
            vector3Value = AssignVector3(parameters, checkParameterID, vector3Value);
            stringValue  = AssignString(parameters, checkParameterID, stringValue);

            runtimeVariable = null;
            switch (location)
            {
            case VariableLocation.Global:
                variableID      = AssignVariableID(parameters, parameterID, variableID);
                runtimeVariable = GlobalVariables.GetVariable(variableID, true);
                break;

            case VariableLocation.Local:
                if (!isAssetFile)
                {
                    variableID      = AssignVariableID(parameters, parameterID, variableID);
                    runtimeVariable = LocalVariables.GetVariable(variableID, localVariables);
                }
                break;

            case VariableLocation.Component:
                Variables runtimeVariables = AssignFile <Variables> (variablesConstantID, variables);
                if (runtimeVariables != null)
                {
                    runtimeVariable = runtimeVariables.GetVariable(variableID);
                }
                runtimeVariable = AssignVariable(parameters, parameterID, runtimeVariable);
                break;
            }

            runtimeCompareVariable = null;
            switch (getVarMethod)
            {
            case GetVarMethod.GlobalVariable:
                compareVariableID      = AssignVariableID(parameters, checkParameterID, compareVariableID);
                runtimeCompareVariable = GlobalVariables.GetVariable(compareVariableID, true);
                break;

            case GetVarMethod.LocalVariable:
                compareVariableID      = AssignVariableID(parameters, checkParameterID, compareVariableID);
                runtimeCompareVariable = LocalVariables.GetVariable(compareVariableID, localVariables);
                break;

            case GetVarMethod.ComponentVariable:
                Variables runtimeCompareVariables = AssignFile <Variables> (compareVariablesConstantID, compareVariables);
                if (runtimeCompareVariables != null)
                {
                    runtimeCompareVariable = runtimeCompareVariables.GetVariable(compareVariableID);
                }
                runtimeCompareVariable = AssignVariable(parameters, checkParameterID, runtimeCompareVariable);
                break;

            default:
                break;
            }
        }
示例#8
0
        override public float Run()
        {
            if (newVariableID != -1 && oldVariableID != -1)
            {
                GVar oldVar;
                if (oldLocation == VariableLocation.Global)
                {
                    oldVar = GlobalVariables.GetVariable(oldVariableID);
                }
                else
                {
                    oldVar = LocalVariables.GetVariable(oldVariableID, localVariables);
                }

                if (newLocation == VariableLocation.Local && !isAssetFile)
                {
                    CopyVariable(LocalVariables.GetVariable(newVariableID, localVariables), oldVar);
                }
                else
                {
                    GVar newVar = GlobalVariables.GetVariable(newVariableID);

                    if (newVar != null)
                    {
                        CopyVariable(newVar, oldVar);
                        newVar.Upload();
                    }
                }

                KickStarter.actionListManager.VariableChanged();
            }

            return(0f);
        }
示例#9
0
        /**
         * <summary>Recalculates the element's size.
         * This should be called whenever a Menu's shape is changed.</summary>
         * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param>
         */
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                return;
            }

            base.ProcessClick(_menu, _slot, _mouseState);
            if (uiToggle != null)
            {
                isOn = uiToggle.isOn;
            }
            else
            {
                if (isOn)
                {
                    isOn = false;
                }
                else
                {
                    isOn = true;
                }
            }

            if (toggleType == AC_ToggleType.Subtitles)
            {
                Options.optionsData.showSubtitles = isOn;
                Options.SavePrefs();
            }
            else if (toggleType == AC_ToggleType.Variable)
            {
                if (varID >= 0)
                {
                    GVar var = GlobalVariables.GetVariable(varID);
                    if (var.type == VariableType.Boolean)
                    {
                        if (isOn)
                        {
                            var.val = 1;
                        }
                        else
                        {
                            var.val = 0;
                        }
                        var.Upload();
                    }
                }
            }

            if (toggleType == AC_ToggleType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
            }

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }
        }
示例#10
0
        override public float Run()
        {
            if (_parameter == null)
            {
                ACDebug.LogWarning("Cannot set parameter value since it cannot be found!");
                return(0f);
            }

            if (setParamMethod == SetParamMethod.CopiedFromGlobalVariable)
            {
                GVar gVar = GlobalVariables.GetVariable(globalVariableID);
                if (gVar != null)
                {
                    if (_parameter.parameterType == ParameterType.Boolean ||
                        _parameter.parameterType == ParameterType.Integer)
                    {
                        _parameter.intValue = gVar.val;
                    }
                    else if (_parameter.parameterType == ParameterType.Float)
                    {
                        _parameter.floatValue = gVar.floatVal;
                    }
                    else if (_parameter.parameterType == ParameterType.String)
                    {
                        _parameter.stringValue = GlobalVariables.GetStringValue(globalVariableID, true, Options.GetLanguage());
                    }
                }
            }
            else if (setParamMethod == SetParamMethod.EnteredHere)
            {
                if (_parameter.parameterType == ParameterType.Boolean ||
                    _parameter.parameterType == ParameterType.Integer ||
                    _parameter.parameterType == ParameterType.GlobalVariable ||
                    _parameter.parameterType == ParameterType.LocalVariable ||
                    _parameter.parameterType == ParameterType.InventoryItem)
                {
                    _parameter.intValue = intValue;
                }
                else if (_parameter.parameterType == ParameterType.Float)
                {
                    _parameter.floatValue = floatValue;
                }
                else if (_parameter.parameterType == ParameterType.String)
                {
                    _parameter.stringValue = stringValue;
                }
                else if (_parameter.parameterType == ParameterType.GameObject)
                {
                    _parameter.gameObject = gameobjectValue;
                    _parameter.intValue   = gameObjectConstantID;
                }
                else if (_parameter.parameterType == ParameterType.UnityObject)
                {
                    _parameter.objectValue = unityObjectValue;
                }
            }

            return(0f);
        }
示例#11
0
        /**
         * <summary>Recalculates the element's size.
         * This should be called whenever a Menu's shape is changed.</summary>
         * <param name = "source">How the parent Menu is displayed (AdventureCreator, UnityUiPrefab, UnityUiInScene)</param>
         */
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (!_menu.IsClickable())
            {
                return;
            }

            if (uiToggle != null)
            {
                isOn = uiToggle.isOn;
            }
            else
            {
                if (isOn)
                {
                    isOn = false;
                }
                else
                {
                    isOn = true;
                }
            }

            if (toggleType == AC_ToggleType.Subtitles)
            {
                Options.SetSubtitles(isOn);
            }
            else if (toggleType == AC_ToggleType.Variable)
            {
                if (varID >= 0)
                {
                    GVar var = GlobalVariables.GetVariable(varID);
                    if (var.type == VariableType.Boolean)
                    {
                        if (isOn)
                        {
                            var.val = 1;
                        }
                        else
                        {
                            var.val = 0;
                        }
                        var.Upload(VariableLocation.Global);
                    }
                }
            }

            if (toggleType == AC_ToggleType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
            }

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }

            base.ProcessClick(_menu, _slot, _mouseState);
        }
示例#12
0
        private void CalculateValue()
        {
            if (!Application.isPlaying)
            {
                visualAmount = 0.5f;
                return;
            }

            if (sliderType == AC_SliderType.Speech || sliderType == AC_SliderType.SFX || sliderType == AC_SliderType.Music)
            {
                if (Options.optionsData != null)
                {
                    if (sliderType == AC_SliderType.Speech)
                    {
                        amount = Options.optionsData.speechVolume;
                    }
                    else if (sliderType == AC_SliderType.Music)
                    {
                        amount = Options.optionsData.musicVolume;
                    }
                    else if (sliderType == AC_SliderType.SFX)
                    {
                        amount = Options.optionsData.sfxVolume;
                    }
                }
            }
            else if (sliderType == AC_SliderType.FloatVariable)
            {
                if (varID >= 0)
                {
                    GVar _variable = GlobalVariables.GetVariable(varID);
                    if (_variable != null)
                    {
                        if (_variable.type != VariableType.Float)
                        {
                            ACDebug.LogWarning("Cannot link MenuSlider " + title + " to Variable " + varID + " as it is not a Float.");
                        }
                        else
                        {
                            amount = Mathf.Clamp(_variable.floatVal, minValue, maxValue);
                            _variable.SetFloatValue(amount);
                        }
                    }
                    else
                    {
                        ACDebug.LogWarning("Slider " + this.label + " is referencing Gloval Variable " + varID + ", which does not exist.");
                    }
                }
            }

            if (uiSlider != null)
            {
                visualAmount = amount;
            }
            else
            {
                visualAmount = (amount - minValue) / (maxValue - minValue);
            }
        }
示例#13
0
        public override void AssignValues(List <ActionParameter> parameters)
        {
            if (isPlayer)
            {
                if (KickStarter.player != null)
                {
                    runtimeLinkedProp = KickStarter.player.GetComponent <Moveable>();
                }
                else
                {
                    runtimeLinkedProp = null;
                }
            }
            else
            {
                runtimeLinkedProp = AssignFile <Moveable> (parameters, parameterID, constantID, linkedProp);
            }

            runtimeMarker  = AssignFile <Marker> (parameters, markerParameterID, markerID, marker);
            transitionTime = AssignFloat(parameters, transitionTimeParameterID, transitionTime);
            newVector      = AssignVector3(parameters, newVectorParameterID, newVector);

            if (!(transformType == TransformType.CopyMarker ||
                  (transformType == TransformType.Translate && toBy == ToBy.To) ||
                  (transformType == TransformType.Rotate && toBy == ToBy.To)))
            {
                inWorldSpace = false;
            }

            runtimeVariable = null;
            if (transformType != TransformType.CopyMarker && setVectorMethod == SetVectorMethod.FromVector3Variable)
            {
                switch (variableLocation)
                {
                case VariableLocation.Global:
                    vectorVarID     = AssignVariableID(parameters, vectorVarParameterID, vectorVarID);
                    runtimeVariable = GlobalVariables.GetVariable(vectorVarID, true);
                    break;

                case VariableLocation.Local:
                    if (!isAssetFile)
                    {
                        vectorVarID     = AssignVariableID(parameters, vectorVarParameterID, vectorVarID);
                        runtimeVariable = LocalVariables.GetVariable(vectorVarID, localVariables);
                    }
                    break;

                case VariableLocation.Component:
                    Variables runtimeVariables = AssignFile <Variables> (variablesConstantID, variables);
                    if (runtimeVariables != null)
                    {
                        runtimeVariable = runtimeVariables.GetVariable(vectorVarID);
                    }
                    runtimeVariable = AssignVariable(parameters, vectorVarParameterID, runtimeVariable);
                    break;
                }
            }
        }
示例#14
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 (variableID == -1)
            {
                return(GenerateStopActionEnd());
            }

            GVar var = null;

            if (location == VariableLocation.Local && !isAssetFile)
            {
                var = LocalVariables.GetVariable(variableID);
            }
            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!");
                }
            }

            return(GenerateStopActionEnd());
        }
示例#15
0
        public override bool ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (!_menu.IsClickable())
            {
                return(false);
            }

            if (uiToggle)
            {
                isOn = uiToggle.isOn;
            }
            else
            {
                if (isOn)
                {
                    isOn = false;
                }
                else
                {
                    isOn = true;
                }
            }

            switch (toggleType)
            {
            case AC_ToggleType.Subtitles:
                Options.SetSubtitles(isOn);
                break;

            case AC_ToggleType.Variable:
                if (varID >= 0)
                {
                    GVar var = GlobalVariables.GetVariable(varID);
                    if (var.type == VariableType.Boolean)
                    {
                        var.IntegerValue = (isOn) ? 1 : 0;
                        var.Upload(VariableLocation.Global);
                    }
                }
                break;

            case AC_ToggleType.CustomScript:
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
                break;

            default:
                break;
            }

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }

            return(base.ProcessClick(_menu, _slot, _mouseState));
        }
        override public float Run()
        {
            if (obToRead != null)
            {
                GVar variable = null;
                if (variableLocation == VariableLocation.Global)
                {
                    variable = GlobalVariables.GetVariable(variableID);
                }
                else if (variableLocation == VariableLocation.Local && !isAssetFile)
                {
                    variable = LocalVariables.GetVariable(variableID);
                }

                if (variable != null)
                {
                    switch (transformRecordType)
                    {
                    case TransformRecordType.Position:
                        if (transformLocation == VariableLocation.Global)
                        {
                            variable.SetVector3Value(obToRead.transform.position);
                        }
                        else if (transformLocation == VariableLocation.Local)
                        {
                            variable.SetVector3Value(obToRead.transform.localPosition);
                        }
                        break;

                    case TransformRecordType.Rotation:
                        if (transformLocation == VariableLocation.Global)
                        {
                            variable.SetVector3Value(obToRead.transform.eulerAngles);
                        }
                        else if (transformLocation == VariableLocation.Local)
                        {
                            variable.SetVector3Value(obToRead.transform.localEulerAngles);
                        }
                        break;

                    case TransformRecordType.Scale:
                        if (transformLocation == VariableLocation.Global)
                        {
                            variable.SetVector3Value(obToRead.transform.lossyScale);
                        }
                        else if (transformLocation == VariableLocation.Local)
                        {
                            variable.SetVector3Value(obToRead.transform.localScale);
                        }
                        break;
                    }
                }
            }

            return(0f);
        }
示例#17
0
        override public void AssignValues(List <ActionParameter> parameters)
        {
            oldRuntimeVariable = null;
            switch (oldLocation)
            {
            case VariableLocation.Global:
                oldVariableID      = AssignVariableID(parameters, oldParameterID, oldVariableID);
                oldRuntimeVariable = GlobalVariables.GetVariable(oldVariableID);
                break;

            case VariableLocation.Local:
                if (!isAssetFile)
                {
                    oldVariableID      = AssignVariableID(parameters, oldParameterID, oldVariableID);
                    oldRuntimeVariable = LocalVariables.GetVariable(oldVariableID, localVariables);
                }
                break;

            case VariableLocation.Component:
                Variables oldRuntimeVariables = AssignFile <Variables> (oldVariablesConstantID, oldVariables);
                if (oldRuntimeVariables != null)
                {
                    oldRuntimeVariable = oldRuntimeVariables.GetVariable(oldVariableID);
                }
                oldRuntimeVariable = AssignVariable(parameters, oldParameterID, oldRuntimeVariable);
                break;
            }

            newRuntimeVariable = null;
            switch (newLocation)
            {
            case VariableLocation.Global:
                newVariableID      = AssignVariableID(parameters, newParameterID, newVariableID);
                newRuntimeVariable = GlobalVariables.GetVariable(newVariableID, true);
                break;

            case VariableLocation.Local:
                if (!isAssetFile)
                {
                    newVariableID      = AssignVariableID(parameters, newParameterID, newVariableID);
                    newRuntimeVariable = LocalVariables.GetVariable(newVariableID, localVariables);
                }
                break;

            case VariableLocation.Component:
                newRuntimeVariables = AssignFile <Variables> (newVariablesConstantID, newVariables);
                if (newRuntimeVariables != null)
                {
                    newRuntimeVariable = newRuntimeVariables.GetVariable(newVariableID);
                }
                newRuntimeVariable  = AssignVariable(parameters, newParameterID, newRuntimeVariable);
                newRuntimeVariables = AssignVariablesComponent(parameters, newParameterID, newRuntimeVariables);
                break;
            }
        }
        override public ActionEnd End(List <Action> actions)
        {
            if (numSockets <= 0)
            {
                ACDebug.LogWarning("Could not compute Random check because no values were possible!");
                return(GenerateStopActionEnd());
            }

            GVar linkedVariable = null;

            if (saveToVariable)
            {
                if (location == VariableLocation.Local && !isAssetFile)
                {
                    linkedVariable = LocalVariables.GetVariable(variableID);
                }
                else
                {
                    linkedVariable = GlobalVariables.GetVariable(variableID);
                }
            }

            int randomResult = Random.Range(0, numSockets);

            if (numSockets > 1 && disallowSuccessive)
            {
                if (saveToVariable)
                {
                    if (linkedVariable != null && linkedVariable.type == VariableType.Integer)
                    {
                        ownVarValue = linkedVariable.val;
                    }
                    else
                    {
                        ACDebug.LogWarning("'Variable: Check random number' Action is referencing a Variable that does not exist or is not an Integer!");
                    }
                }

                while (ownVarValue == randomResult)
                {
                    randomResult = Random.Range(0, numSockets);
                }

                ownVarValue = randomResult;

                if (saveToVariable && linkedVariable != null && linkedVariable.type == VariableType.Integer)
                {
                    linkedVariable.SetValue(ownVarValue);
                }
            }

            return(ProcessResult(randomResult, actions));
        }
示例#19
0
        override public void AssignValues(List <ActionParameter> parameters)
        {
            if (invAction == InvAction.Add || invAction == InvAction.Replace)
            {
                _gameObject = AssignFile(parameters, parameterID, 0, gameObject);

                if (invAction == InvAction.Replace)
                {
                    replaceGameObject = AssignFile(parameters, replaceParameterID, replaceConstantID, replaceGameObject);
                }
                else if (invAction == InvAction.Add)
                {
                    relativeGameObject = AssignFile(parameters, relativeGameObjectParameterID, relativeGameObjectID, relativeGameObject);
                }
            }
            else if (invAction == InvAction.Remove)
            {
                _gameObject = AssignFile(parameters, parameterID, constantID, gameObject);
            }

            relativeVector = AssignVector3(parameters, relativeVectorParameterID, relativeVector);

            if (invAction == InvAction.Add && positionRelativeTo == PositionRelativeTo.VectorVariable)
            {
                runtimeVariable = null;
                switch (variableLocation)
                {
                case VariableLocation.Global:
                    vectorVarID     = AssignVariableID(parameters, vectorVarParameterID, vectorVarID);
                    runtimeVariable = GlobalVariables.GetVariable(vectorVarID, true);
                    break;

                case VariableLocation.Local:
                    if (!isAssetFile)
                    {
                        vectorVarID     = AssignVariableID(parameters, vectorVarParameterID, vectorVarID);
                        runtimeVariable = LocalVariables.GetVariable(vectorVarID, localVariables);
                    }
                    break;

                case VariableLocation.Component:
                    Variables runtimeVariables = AssignFile <Variables> (variablesConstantID, variables);
                    if (runtimeVariables != null)
                    {
                        runtimeVariable = runtimeVariables.GetVariable(vectorVarID);
                    }
                    runtimeVariable = AssignVariable(parameters, vectorVarParameterID, runtimeVariable);
                    break;
                }
            }
        }
示例#20
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());
            }
        }
 override public void Skip()
 {
     if (variableID != -1)
     {
         if (location == VariableLocation.Local && !isAssetFile)
         {
             SetVariable(LocalVariables.GetVariable(variableID), VariableLocation.Local, true);
         }
         else
         {
             SetVariable(GlobalVariables.GetVariable(variableID), VariableLocation.Global, true);
         }
     }
 }
示例#22
0
        override public ActionEnd End(List <AC.Action> actions)
        {
            if (_parameter == null)
            {
                return(GenerateStopActionEnd());
            }

            GVar     compareVar  = null;
            InvItem  compareItem = null;
            Document compareDoc  = null;

            if (_parameter.parameterType == ParameterType.GlobalVariable ||
                _parameter.parameterType == ParameterType.LocalVariable ||
                _parameter.parameterType == ParameterType.ComponentVariable ||
                _parameter.parameterType == ParameterType.InventoryItem ||
                _parameter.parameterType == ParameterType.Document)
            {
                if (compareVariableID == -1)
                {
                    return(GenerateStopActionEnd());
                }

                if (_parameter.parameterType == ParameterType.GlobalVariable)
                {
                    compareVar = GlobalVariables.GetVariable(compareVariableID, true);
                }
                else if (_parameter.parameterType == ParameterType.LocalVariable && !isAssetFile)
                {
                    compareVar = LocalVariables.GetVariable(compareVariableID);
                }
                else if (_parameter.parameterType == ParameterType.ComponentVariable)
                {
                    runtimeCompareVariables = AssignFile <Variables> (compareObjectConstantID, compareVariables);
                    if (runtimeCompareVariables != null)
                    {
                        compareVar = runtimeCompareVariables.GetVariable(compareVariableID);
                    }
                }
                else if (_parameter.parameterType == ParameterType.InventoryItem)
                {
                    compareItem = KickStarter.inventoryManager.GetItem(compareVariableID);
                }
                else if (_parameter.parameterType == ParameterType.Document)
                {
                    compareDoc = KickStarter.inventoryManager.GetDocument(compareVariableID);
                }
            }

            return(ProcessResult(CheckCondition(compareItem, compareVar, compareDoc), actions));
        }
        override public float Run()
        {
            if (variableID != -1)
            {
                if (location == VariableLocation.Local && !isAssetFile)
                {
                    SetVariable(LocalVariables.GetVariable(variableID), VariableLocation.Local, false);
                }
                else
                {
                    SetVariable(GlobalVariables.GetVariable(variableID), VariableLocation.Global, false);
                }
            }

            return(0f);
        }
示例#24
0
        private void CalculateValue()
        {
            if (!Application.isPlaying)
            {
                return;
            }

            if (cycleType == AC_CycleType.Language)
            {
                if (Application.isPlaying)
                {
                    optionsArray = KickStarter.runtimeLanguages.Languages;
                }
                else
                {
                    optionsArray = AdvGame.GetReferences().speechManager.languages;
                }

                if (Options.optionsData != null)
                {
                    selected = Options.optionsData.language;

                    if (KickStarter.speechManager != null && KickStarter.speechManager.separateVoiceAndTextLanguages && splitLanguageType == SplitLanguageType.VoiceOnly)
                    {
                        selected = Options.optionsData.voiceLanguage;
                    }
                }
            }
            else if (cycleType == AC_CycleType.Variable)
            {
                if (varID >= 0)
                {
                    if (GlobalVariables.GetVariable(varID) == null || GlobalVariables.GetVariable(varID).type != VariableType.Integer)
                    {
                        ACDebug.LogWarning("Cannot link MenuToggle " + title + " to Variable " + varID + " as it is not an Integer.");
                    }
                    else if (optionsArray.Count > 0)
                    {
                        selected = Mathf.Clamp(GlobalVariables.GetIntegerValue(varID), 0, optionsArray.Count - 1);
                    }
                    else
                    {
                        selected = 0;
                    }
                }
            }
        }
示例#25
0
        /**
         * <summary>Performs what should happen when the element is clicked on.</summary>
         * <param name = "_menu">The element's parent Menu</param>
         * <param name = "_slot">Ignored by this subclass</param>
         * <param name = "_mouseState">The state of the mouse button</param>
         */
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (!_menu.IsClickable())
            {
                return;
            }

            base.ProcessClick(_menu, _slot, _mouseState);

            selected++;
            if (selected > optionsArray.Count - 1)
            {
                selected = 0;
            }

            if (cycleType == AC_CycleType.Language)
            {
                if (selected == 0 && KickStarter.speechManager.ignoreOriginalText && KickStarter.runtimeLanguages.Languages.Count > 1)
                {
                    // Ignore original text by skipping to first language
                    selected = 1;
                }
                Options.SetLanguage(selected);
            }
            else if (cycleType == AC_CycleType.Variable)
            {
                if (varID >= 0)
                {
                    GVar var = GlobalVariables.GetVariable(varID);
                    if (var.type == VariableType.Integer)
                    {
                        var.val = selected;
                        var.Upload();
                    }
                }
            }

            if (cycleType == AC_CycleType.CustomScript)
            {
                MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState);
            }

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset(actionListOnClick);
            }
        }
示例#26
0
        public GVar GetVariable()
        {
            switch (parameterType)
            {
            case ParameterType.GlobalVariable:
                return(GlobalVariables.GetVariable(intValue, true));

            case ParameterType.LocalVariable:
                return(LocalVariables.GetVariable(intValue));

            case ParameterType.ComponentVariable:
                if (variables != null)
                {
                    return(variables.GetVariable(intValue));
                }
                break;
            }
            return(null);
        }
示例#27
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());
            }
        }
        override public void AssignValues(List <ActionParameter> parameters)
        {
            runtimeObToMove    = AssignFile(parameters, obToMoveParameterID, obToMoveID, obToMove);
            runtimeTeleporter  = AssignFile <Marker> (parameters, markerParameterID, markerID, teleporter);
            relativeGameObject = AssignFile(parameters, relativeGameObjectParameterID, relativeGameObjectID, relativeGameObject);

            relativeVector = AssignVector3(parameters, relativeVectorParameterID, relativeVector);

            if (isPlayer && KickStarter.player)
            {
                runtimeObToMove = KickStarter.player.gameObject;
            }

            runtimeVariable = null;
            if (positionRelativeTo == PositionRelativeTo.VectorVariable)
            {
                switch (variableLocation)
                {
                case VariableLocation.Global:
                    vectorVarID     = AssignVariableID(parameters, vectorVarParameterID, vectorVarID);
                    runtimeVariable = GlobalVariables.GetVariable(vectorVarID, true);
                    break;

                case VariableLocation.Local:
                    if (!isAssetFile)
                    {
                        vectorVarID     = AssignVariableID(parameters, vectorVarParameterID, vectorVarID);
                        runtimeVariable = LocalVariables.GetVariable(vectorVarID, localVariables);
                    }
                    break;

                case VariableLocation.Component:
                    Variables runtimeVariables = AssignFile <Variables> (variablesConstantID, variables);
                    if (runtimeVariables != null)
                    {
                        runtimeVariable = runtimeVariables.GetVariable(vectorVarID);
                    }
                    runtimeVariable = AssignVariable(parameters, vectorVarParameterID, runtimeVariable);
                    break;
                }
            }
        }
        override public float Run()
        {
            GVar myVar = (varLocation == VariableLocation.Global) ?
                         GlobalVariables.GetVariable(variableID) :
                         LocalVariables.GetVariable(variableID, localVariables);

            InvItem invItem = (setVarAsPropertyMethod == SetVarAsPropertyMethod.SelectedItem) ?
                              KickStarter.runtimeInventory.LastSelectedItem :
                              KickStarter.inventoryManager.GetItem(invID);

            if (invItem != null && myVar != null)
            {
                InvVar invVar = invItem.GetProperty(propertyID);

                if (myVar.type == VariableType.String)
                {
                    myVar.textVal = invVar.GetDisplayValue(Options.GetLanguage());
                }
                else if (myVar.type == invVar.type)
                {
                    if (invVar.type == VariableType.Float)
                    {
                        myVar.FloatValue = invVar.FloatValue;
                    }
                    else if (invVar.type == VariableType.Vector3)
                    {
                        myVar.Vector3Value = invVar.Vector3Value;
                    }
                    else
                    {
                        myVar.IntegerValue = invVar.IntegerValue;
                    }
                }
                else
                {
                    ACDebug.LogWarning("Cannot assign " + varLocation.ToString() + " Variable " + myVar.label + "'s value from '" + invVar.label + "' property because their types do not match.");
                }
            }

            return(0);
        }
示例#30
0
        public override void OnMenuTurnOn(Menu menu)
        {
            if (cycleType == AC_CycleType.Variable)
            {
                linkedVariable = GlobalVariables.GetVariable(varID);
                if (linkedVariable != null)
                {
                    if (linkedVariable.type != VariableType.Integer && linkedVariable.type != VariableType.PopUp)
                    {
                        ACDebug.LogWarning("Cannot link the variable '" + linkedVariable.label + "' to Cycle element '" + title + "' because it is not an Integer or PopUp.");
                        linkedVariable = null;
                    }
                }
                else
                {
                    ACDebug.LogWarning("Cannot find the variable with ID=" + varID + " to link to the Cycle element '" + title + "'");
                }
            }

            base.OnMenuTurnOn(menu);
        }