public static void PropertiesGUI(AC_Trigger _target)
        {
            string[] Options = { "On enter", "Continuous", "On exit" };

            if (Application.isPlaying)
            {
                if (!_target.IsOn ())
                {
                    EditorGUILayout.HelpBox ("Current state: OFF", MessageType.Info);
                }
            }

            EditorGUILayout.BeginVertical ("Button");
            EditorGUILayout.LabelField ("Trigger properties", EditorStyles.boldLabel);
            _target.source = (ActionListSource) EditorGUILayout.EnumPopup ("Actions source:", _target.source);
            if (_target.source == ActionListSource.AssetFile)
            {
                _target.assetFile = (ActionListAsset) EditorGUILayout.ObjectField ("ActionList asset:", _target.assetFile, typeof (ActionListAsset), false);
            }
            _target.actionListType = (ActionListType) EditorGUILayout.EnumPopup ("When running:", _target.actionListType);
            if (_target.actionListType == ActionListType.PauseGameplay)
            {
                _target.isSkippable = EditorGUILayout.Toggle ("Is skippable?", _target.isSkippable);
            }
            _target.triggerType = EditorGUILayout.Popup ("Trigger type:", _target.triggerType, Options);
            _target.cancelInteractions = EditorGUILayout.Toggle ("Cancels interactions?", _target.cancelInteractions);
            _target.useParameters = EditorGUILayout.Toggle ("Set collider as parameter?", _target.useParameters);

            EditorGUILayout.Space ();
            _target.detects = (TriggerDetects) EditorGUILayout.EnumPopup ("Trigger detects:", _target.detects);
            if (_target.detects == TriggerDetects.AnyObjectWithComponent)
            {
                _target.detectComponent = EditorGUILayout.TextField ("Component name:", _target.detectComponent);
            }
            else if (_target.detects == TriggerDetects.AnyObjectWithTag)
            {
                _target.detectComponent = EditorGUILayout.TextField ("Tag name:", _target.detectComponent);
            }
            else if (_target.detects == TriggerDetects.SetObject)
            {
                _target.obToDetect = (GameObject) EditorGUILayout.ObjectField ("Object to detect:", _target.obToDetect, typeof (GameObject), true);
            }
            EditorGUILayout.EndVertical ();

            if (_target.useParameters)
            {
                if (_target.parameters.Count != 1)
                {
                    ActionParameter newParameter = new ActionParameter (0);
                    newParameter.parameterType = ParameterType.GameObject;
                    newParameter.label = "Collision object";
                    _target.parameters.Clear ();
                    _target.parameters.Add (newParameter);
                }
            }
        }
示例#2
0
        protected int AssignInteger(List <ActionParameter> parameters, int _parameterID, int field)
        {
            ActionParameter parameter = GetParameterWithID(parameters, _parameterID);

            if (parameter != null && parameter.parameterType == ParameterType.Integer)
            {
                return(parameter.intValue);
            }
            return(field);
        }
示例#3
0
        protected int AssignVariableID(List <ActionParameter> parameters, int _parameterID, int field)
        {
            ActionParameter parameter = GetParameterWithID(parameters, _parameterID);

            if (parameter != null && (parameter.parameterType == ParameterType.GlobalVariable || parameter.parameterType == ParameterType.LocalVariable))
            {
                return(parameter.intValue);
            }
            return(field);
        }
示例#4
0
        protected Vector3 AssignVector3(List <ActionParameter> parameters, int _parameterID, Vector3 field)
        {
            ActionParameter parameter = GetParameterWithID(parameters, _parameterID);

            if (parameter != null && parameter.parameterType == ParameterType.Vector3)
            {
                return(parameter.vector3Value);
            }
            return(field);
        }
示例#5
0
        protected float AssignFloat(List <ActionParameter> parameters, int _parameterID, float field)
        {
            ActionParameter parameter = GetParameterWithID(parameters, _parameterID);

            if (parameter != null && parameter.parameterType == ParameterType.Float)
            {
                return(parameter.floatValue);
            }
            return(field);
        }
示例#6
0
        protected string AssignString(List <ActionParameter> parameters, int _parameterID, string field)
        {
            ActionParameter parameter = GetParameterWithID(parameters, _parameterID);

            if (parameter != null && parameter.parameterType == ParameterType.String)
            {
                return(parameter.stringValue);
            }
            return(field);
        }
示例#7
0
        protected void Interact(GameObject collisionOb)
        {
            if (cancelInteractions)
            {
                KickStarter.playerInteraction.StopMovingToHotspot();
            }

            if (actionListType == ActionListType.PauseGameplay)
            {
                KickStarter.playerInteraction.DeselectHotspot(false);
            }

            KickStarter.eventManager.Call_OnRunTrigger(this, collisionOb);

            // Set correct parameter
            if (collisionOb != null)
            {
                if (source == ActionListSource.InScene)
                {
                    if (useParameters && parameters != null && parameters.Count >= 1)
                    {
                        if (parameters[0].parameterType == ParameterType.GameObject)
                        {
                            parameters[0].gameObject = collisionOb;
                        }
                        else
                        {
                            ACDebug.Log("Cannot set the value of parameter 0 ('" + parameters[0].label + "') as it is not of the type 'Game Object'.", this);
                        }
                    }
                }
                else if (source == ActionListSource.AssetFile &&
                         assetFile != null &&
                         assetFile.NumParameters > 0 &&
                         gameObjectParameterID >= 0)
                {
                    ActionParameter param = null;
                    if (syncParamValues)
                    {
                        param = assetFile.GetParameter(gameObjectParameterID);
                    }
                    else
                    {
                        param = GetParameter(gameObjectParameterID);
                    }

                    if (param != null)
                    {
                        param.SetValue(collisionOb);
                    }
                }
            }

            base.Interact();
        }
示例#8
0
        protected void RunInteraction(bool onMove)
        {
            int parameterID = (onMove) ? moveParameterID : dropParameterID;

            switch (actionListSource)
            {
            case ActionListSource.InScene:
                Interaction interaction = (onMove) ? interactionOnMove : interactionOnDrop;
                if (interaction != null && gameObject.layer != LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer))
                {
                    if (!onMove || !KickStarter.actionListManager.IsListRunning(interaction))
                    {
                        if (parameterID >= 0)
                        {
                            ActionParameter parameter = interaction.GetParameter(parameterID);
                            if (parameter != null && parameter.parameterType == ParameterType.GameObject)
                            {
                                parameter.gameObject = gameObject;
                            }
                        }

                        interaction.Interact();
                    }
                }
                break;

            case ActionListSource.AssetFile:
                ActionListAsset actionListAsset = (onMove) ? actionListAssetOnMove : actionListAssetOnDrop;
                if (actionListAsset != null && gameObject.layer != LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer))
                {
                    if (!onMove || !KickStarter.actionListAssetManager.IsListRunning(actionListAsset))
                    {
                        if (parameterID >= 0)
                        {
                            ActionParameter parameter = actionListAsset.GetParameter(parameterID);
                            if (parameter != null && parameter.parameterType == ParameterType.GameObject)
                            {
                                parameter.gameObject = gameObject;
                                if (GetComponent <ConstantID>())
                                {
                                    parameter.intValue = GetComponent <ConstantID>().constantID;
                                }
                                else
                                {
                                    ACDebug.LogWarning("Cannot set the value of parameter " + parameterID + " ('" + parameter.label + "') as " + gameObject.name + " has no Constant ID component.", gameObject);
                                }
                            }
                        }

                        actionListAsset.Interact();
                    }
                }
                break;
            }
        }
示例#9
0
        override public void AssignValues(List <ActionParameter> parameters)
        {
            _compareParameter       = null;
            _parameter              = null;
            runtimeCompareVariables = null;

            if (!checkOwn)
            {
                if (actionListSource == ActionListSource.InScene)
                {
                    actionList = AssignFile <ActionList> (actionListConstantID, actionList);
                    if (actionList != null)
                    {
                        if (actionList.source == ActionListSource.AssetFile && actionList.assetFile != null)
                        {
                            if (actionList.syncParamValues && actionList.assetFile.useParameters)
                            {
                                _parameter        = GetParameterWithID(actionList.assetFile.parameters, parameterID);
                                _compareParameter = GetParameterWithID(actionList.assetFile.parameters, compareParameterID);
                            }
                            else
                            {
                                _parameter        = GetParameterWithID(actionList.parameters, parameterID);
                                _compareParameter = GetParameterWithID(actionList.parameters, compareParameterID);
                            }
                        }
                        else if (actionList.source == ActionListSource.InScene && actionList.useParameters)
                        {
                            _parameter        = GetParameterWithID(actionList.parameters, parameterID);
                            _compareParameter = GetParameterWithID(actionList.parameters, compareParameterID);
                        }
                    }
                }
                else if (actionListSource == ActionListSource.AssetFile)
                {
                    if (actionListAsset != null)
                    {
                        _parameter        = GetParameterWithID(actionListAsset.parameters, parameterID);
                        _compareParameter = GetParameterWithID(actionListAsset.parameters, compareParameterID);
                    }
                }
            }
            else
            {
                _parameter        = GetParameterWithID(parameters, parameterID);
                _compareParameter = GetParameterWithID(parameters, compareParameterID);
            }

            if (_compareParameter == _parameter)
            {
                _compareParameter = null;
            }

            runtimeCompareObject = AssignFile(compareObjectConstantID, compareObject);
        }
示例#10
0
        /**
         * <summary>A Constructor that duplicates another ActionParameter.</summary>
         */
        public ActionParameter(ActionParameter _actionParameter)
        {
            label         = _actionParameter.label;
            ID            = _actionParameter.ID;
            parameterType = _actionParameter.parameterType;

            intValue    = -1;
            floatValue  = 0f;
            stringValue = "";
            gameObject  = null;
        }
示例#11
0
 /**
  * <summary>Copies the "value" variables from another ActionParameter, without changing the type, ID, or label.</summary>
  * <parameter name = "otherParameter">The ActionParameter to copy from</param>
  */
 public void CopyValues(ActionParameter otherParameter)
 {
     intValue     = otherParameter.intValue;
     floatValue   = otherParameter.floatValue;
     stringValue  = otherParameter.stringValue;
     gameObject   = otherParameter.gameObject;
     objectValue  = otherParameter.objectValue;
     vector3Value = otherParameter.vector3Value;
     gameObjectParameterReferences = otherParameter.gameObjectParameterReferences;
     variables = otherParameter.variables;
 }
示例#12
0
        private void Awake()
        {
                        #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                CopyScriptable();
                return;
            }
                        #endif

            LayerHotspot = LayerMask.NameToLayer(KickStarter.settingsManager.hotspotLayer);
            LayerOff     = LayerMask.NameToLayer(KickStarter.settingsManager.deactivatedLayer);

            // If asset-based, download actions
            if (source == ActionListSource.AssetFile)
            {
                actions.Clear();
                if (assetFile != null && assetFile.actions.Count > 0)
                {
                    foreach (AC.Action action in assetFile.actions)
                    {
                        actions.Add(action);
                    }
                    useParameters = assetFile.useParameters;

                    if (syncParamValues)
                    {
                        parameters = assetFile.parameters;
                    }
                    else
                    {
                        parameters.Clear();
                        foreach (ActionParameter parameter in assetFile.parameters)
                        {
                            if (parameter != null)
                            {
                                ActionParameter newParameter = new ActionParameter(parameter);
                                parameters.Add(newParameter);
                            }
                        }
                    }
                }
            }

            if (useParameters)
            {
                // Reset all parameters
                foreach (ActionParameter _parameter in parameters)
                {
                    _parameter.Reset();
                }
            }
        }
示例#13
0
        public static void ShowParametersGUI(ActionList actionList, ActionListAsset actionListAsset, List <ActionParameter> parameters, bool readOnly = false)
        {
            for (int i = 0; i < parameters.Count; i++)
            {
                if (Application.isPlaying)
                {
                    EditorGUILayout.LabelField("Label " + parameters[i].ID + ":", parameters[i].label);
                    parameters[i].ShowGUI(actionListAsset != null);
                }
                else
                {
                    EditorGUILayout.BeginHorizontal();

                    if (readOnly)
                    {
                        EditorGUILayout.LabelField("Label " + parameters[i].ID + ":", parameters[i].label);
                    }
                    else
                    {
                        parameters[i].label = EditorGUILayout.TextField("Label " + parameters[i].ID + ":", parameters[i].label);
                    }
                    if (GUILayout.Button(string.Empty, CustomStyles.IconCog))
                    {
                        ParameterSideMenu(actionList, actionListAsset, parameters.Count, i);
                    }

                    EditorGUILayout.EndHorizontal();

                    parameters[i].ShowGUI(actionListAsset != null, false, readOnly);
                }

                if (i < (parameters.Count - 1))
                {
                    GUILayout.Box(string.Empty, GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }

                if (parameters.Count > 0)
                {
                    EditorGUILayout.Space();
                }
            }

            if (!Application.isPlaying && !readOnly)
            {
                if (GUILayout.Button("Create new parameter", EditorStyles.miniButton))
                {
                    ActionParameter newParameter = new ActionParameter(ActionListEditor.GetParameterIDArray(parameters));
                    newParameter.parameterType = ParameterType.Integer;
                    parameters.Add(newParameter);
                }
            }
        }
示例#14
0
文件: Action.cs 项目: IJkeB/Ekster1
        protected BoolValue AssignBoolean(List <ActionParameter> parameters, int _parameterID, BoolValue field)
        {
            ActionParameter parameter = GetParameterWithID(parameters, _parameterID);

            if (parameter != null && parameter.parameterType == ParameterType.Boolean)
            {
                if (parameter.intValue == 1)
                {
                    return(BoolValue.True);
                }
                return(BoolValue.False);
            }
            return(field);
        }
        public override int GetVariableReferences(List <ActionParameter> parameters, VariableLocation location, int varID)
        {
            int thisCount = 0;

            if (setParamMethod == SetParamMethod.CopiedFromGlobalVariable && location == VariableLocation.Global && globalVariableID == varID)
            {
                thisCount++;
            }

            if (setParamMethod == SetParamMethod.EnteredHere)
            {
                ActionParameter _param = null;

                if (changeOwn && parameters != null)
                {
                    _param = GetParameterWithID(parameters, parameterID);
                }
                else
                {
                    if (actionListSource == ActionListSource.InScene && actionList != null)
                    {
                        if (actionList.source == ActionListSource.InScene && actionList.useParameters)
                        {
                            _param = GetParameterWithID(actionList.parameters, parameterID);
                        }
                        else if (actionList.source == ActionListSource.AssetFile && actionList.assetFile != null && actionList.assetFile.useParameters)
                        {
                            _param = GetParameterWithID(actionList.assetFile.parameters, parameterID);
                        }
                    }
                    else if (actionListSource == ActionListSource.AssetFile && actionListAsset != null && actionListAsset.useParameters)
                    {
                        _param = GetParameterWithID(actionListAsset.parameters, parameterID);
                    }
                }

                if (_param != null && _param.parameterType == ParameterType.LocalVariable && location == VariableLocation.Local && varID == intValue)
                {
                    thisCount++;
                }
                else if (_param != null && _param.parameterType == ParameterType.GlobalVariable && location == VariableLocation.Global && varID == intValue)
                {
                    thisCount++;
                }
            }

            thisCount += base.GetVariableReferences(parameters, location, varID);
            return(thisCount);
        }
示例#16
0
        public override int GetVariableReferences(List <ActionParameter> parameters, VariableLocation location, int varID, Variables _variables)
        {
            int thisCount = 0;

            ActionParameter _param = null;

            if (checkOwn)
            {
                if (parameters != null)
                {
                    _param = GetParameterWithID(parameters, parameterID);
                }
            }
            else
            {
                if (actionListSource == ActionListSource.InScene && actionList != null)
                {
                    if (actionList.source == ActionListSource.InScene && actionList.useParameters)
                    {
                        _param = GetParameterWithID(actionList.parameters, parameterID);
                    }
                    else if (actionList.source == ActionListSource.AssetFile && actionList.assetFile != null && actionList.assetFile.useParameters)
                    {
                        _param = GetParameterWithID(actionList.assetFile.parameters, parameterID);
                    }
                }
                else if (actionListSource == ActionListSource.AssetFile && actionListAsset != null && actionListAsset.useParameters)
                {
                    _param = GetParameterWithID(actionListAsset.parameters, parameterID);
                }
            }


            if (_param != null && _param.parameterType == ParameterType.LocalVariable && location == VariableLocation.Local && varID == intValue)
            {
                thisCount++;
            }
            else if (_param != null && _param.parameterType == ParameterType.GlobalVariable && location == VariableLocation.Global && varID == intValue)
            {
                thisCount++;
            }
            else if (_param != null && _param.parameterType == ParameterType.ComponentVariable && location == VariableLocation.Component && varID == intValue && _param.variables == _variables)
            {
                thisCount++;
            }

            thisCount += base.GetVariableReferences(parameters, location, varID, _variables);
            return(thisCount);
        }
示例#17
0
        private void DownloadParameters()
        {
            // If asset-based, download actions
            if (source == ActionListSource.AssetFile)
            {
                actions.Clear();
                if (assetFile && assetFile.actions.Count > 0)
                {
                    foreach (AC.Action action in assetFile.actions)
                    {
                        actions.Add(action);
                        actions[actions.Count - 1].isAssetFile = false;
                    }

                    if (!syncParamValues && useParameters && assetFile.useParameters && parameters.Count == assetFile.DefaultParameters.Count)
                    {
                        // Using local parameters
                        return;
                    }

                    if (!assetFile.useParameters)
                    {
                        useParameters = false;
                    }
                    else
                    {
                        if (syncParamValues)
                        {
                            parameters    = assetFile.GetParameters();
                            useParameters = true;
                        }
                        else
                        {
                            parameters.Clear();
                            foreach (ActionParameter parameter in assetFile.DefaultParameters)
                            {
                                if (parameter != null)
                                {
                                    ActionParameter newParameter = new ActionParameter(parameter, !useParameters);
                                    parameters.Add(newParameter);
                                }
                            }
                            useParameters = true;
                        }
                    }
                }
            }
        }
示例#18
0
        private static void ModifyParameter(ActionListAsset _target, int i, string callback)
        {
            if (_target == null || _target.parameters == null)
            {
                return;
            }

            ActionParameter moveParameter = _target.parameters[i];

            switch (callback)
            {
            case "Insert":
                Undo.RecordObject(_target, "Create parameter");
                ActionParameter newParameter = new ActionParameter(ActionListEditor.GetParameterIDArray(_target.parameters));
                _target.parameters.Insert(i + 1, newParameter);
                break;

            case "Delete":
                Undo.RecordObject(_target, "Delete parameter");
                _target.parameters.RemoveAt(i);
                break;

            case "Move to top":
                Undo.RecordObject(_target, "Move parameter to top");
                _target.parameters.Remove(moveParameter);
                _target.parameters.Insert(0, moveParameter);
                break;

            case "Move up":
                Undo.RecordObject(_target, "Move parameter up");
                _target.parameters.Remove(moveParameter);
                _target.parameters.Insert(i - 1, moveParameter);
                break;

            case "Move to bottom":
                Undo.RecordObject(_target, "Move parameter to bottom");
                _target.parameters.Remove(moveParameter);
                _target.parameters.Insert(_target.parameters.Count, moveParameter);
                break;

            case "Move down":
                Undo.RecordObject(_target, "Move parameter down");
                _target.parameters.Remove(moveParameter);
                _target.parameters.Insert(i + 1, moveParameter);
                break;
            }
        }
示例#19
0
        /**
         * <summary>Replaces a GameObject based on an ActionParameter or ConstantID instance, if appropriate.</summary>
         * <param name = "parameters">A List of ActionParameters that may override the GameObject</param>
         * <param name = "_parameterID">The ID of the ActionParameter to search for within parameters that will replace the GameObject</param>
         * <param name = "_constantID">If !=0, The ConstantID number of the GameObject to replace field with</param>
         * <param name = "field">The GameObject to replace</param>
         * <returns>The replaced GameObject, or field if no replacements were found</returns>
         */
        protected GameObject AssignFile(List <ActionParameter> parameters, int _parameterID, int _constantID, GameObject field)
        {
            GameObject file = field;

            ActionParameter parameter = GetParameterWithID(parameters, _parameterID);

            if (parameter != null && parameter.parameterType == ParameterType.GameObject)
            {
                file = null;
                if (parameter.intValue != 0)
                {
                    ConstantID idObject = Serializer.returnComponent <ConstantID> (parameter.intValue);
                    if (idObject != null)
                    {
                        file = idObject.gameObject;
                    }
                }

                if (file == null)
                {
                    if (parameter.gameObject != null)
                    {
                        file = parameter.gameObject;
                    }
                    else if (parameter.intValue != 0)
                    {
                        ConstantID idObject = Serializer.returnComponent <ConstantID> (parameter.intValue);
                        if (idObject != null)
                        {
                            file = idObject.gameObject;
                        }
                    }
                }
            }
            else if (_constantID != 0)
            {
                ConstantID idObject = Serializer.returnComponent <ConstantID> (_constantID);
                if (idObject != null)
                {
                    file = idObject.gameObject;
                }
            }

            return(file);
        }
示例#20
0
        public void SetParameter(ActionListSource source, GameObject gameObject)
        {
            if (source == ActionListSource.InScene && cutscene != null)
            {
                if (cutscene.useParameters && parameterID >= 0 && cutscene.parameters.Count > parameterID)
                {
                    ActionParameter parameter = cutscene.GetParameter(parameterID);
                    if (parameter != null)
                    {
                        parameter.SetValue(gameObject);
                    }
                }

                if (!pausesCharacter)
                {
                    cutscene.Interact();
                }
            }
            else if (source == ActionListSource.AssetFile && actionListAsset != null)
            {
                if (actionListAsset.useParameters && parameterID >= 0 && actionListAsset.parameters.Count > parameterID)
                {
                    int idToSend = 0;
                    if (gameObject.GetComponent <ConstantID>())
                    {
                        idToSend = gameObject.GetComponent <ConstantID>().constantID;
                    }
                    else
                    {
                        ACDebug.LogWarning(gameObject.name + " requires a ConstantID script component!", gameObject);
                    }

                    ActionParameter parameter = actionListAsset.GetParameter(parameterID);
                    if (parameter != null)
                    {
                        parameter.SetValue(idToSend);
                    }
                }

                if (!pausesCharacter)
                {
                    actionListAsset.Interact();
                }
            }
        }
        public override int GetVariableReferences(List <ActionParameter> parameters, VariableLocation location, int varID)
        {
            int thisCount = 0;

            ActionParameter _param = GetParameterWithID(parameters, parameterID);

            if (_param != null && _param.parameterType == ParameterType.LocalVariable && location == VariableLocation.Local && varID == intValue)
            {
                thisCount++;
            }
            else if (_param != null && _param.parameterType == ParameterType.GlobalVariable && location == VariableLocation.Global && varID == intValue)
            {
                thisCount++;
            }

            thisCount += base.GetVariableReferences(parameters, location, varID);
            return(thisCount);
        }
示例#22
0
        /**
         * <summary>Replaces a Transform based on an ActionParameter or ConstantID instance, if appropriate.</summary>
         * <param name = "parameters">A List of ActionParameters that may override the Transform</param>
         * <param name = "_parameterID">The ID of the ActionParameter to search for within parameters that will replace the Transform</param>
         * <param name = "_constantID">If !=0, The ConstantID number of the Transform to replace field with</param>
         * <param name = "field">The Transform to replace</param>
         * <returns>The replaced Transform, or field if no replacements were found</returns>
         */
        public Transform AssignFile(List <ActionParameter> parameters, int _parameterID, int _constantID, Transform field)
        {
            Transform file = field;

            ActionParameter parameter = GetParameterWithID(parameters, _parameterID);

            if (parameter != null && parameter.parameterType == ParameterType.GameObject)
            {
                if (parameter.intValue != 0)
                {
                    ConstantID idObject = Serializer.returnComponent <ConstantID> (parameter.intValue);
                    if (idObject != null)
                    {
                        file = idObject.gameObject.transform;
                    }
                }

                if (file == null)
                {
                    if (/*!isAssetFile && */ parameter.gameObject != null)
                    {
                        file = parameter.gameObject.transform;
                    }
                    else if (parameter.intValue != 0)
                    {
                        ConstantID idObject = Serializer.returnComponent <ConstantID> (parameter.intValue);
                        if (idObject != null)
                        {
                            file = idObject.gameObject.transform;
                        }
                    }
                }
            }
            else if (_constantID != 0)
            {
                ConstantID idObject = Serializer.returnComponent <ConstantID> (_constantID);
                if (idObject != null)
                {
                    file = idObject.gameObject.transform;
                }
            }

            return(file);
        }
示例#23
0
        /**
         * <summary>Updates a List of parameter values to be used at runtime.</summary>
         * <param name="newParameters">The new parameter values.  Parameters will be updated by matchind ID value, not by index.  Parameters that are not included in the list will not be updated.</param>
         */
        public void AssignParameterValues(List <ActionParameter> newParameters)
        {
            if (useParameters && parameters != null)
            {
                if (runtimeParameters == null)
                {
                    runtimeParameters = new List <ActionParameter> ();
                }

                foreach (ActionParameter newParameter in newParameters)
                {
                    ActionParameter matchingParameter = GetParameter(newParameter.ID);
                    if (matchingParameter != null)
                    {
                        matchingParameter.CopyValues(newParameter);
                    }
                }
            }
        }
示例#24
0
        /**
         * <summary>Gets a parameter of a given ID number. This is not a default parameter, but one used at runtime to actually modify Actions.</summary>
         * <param name = "_ID">The ID of the parameter to get</param>
         * <returns>The parameter with the given ID number</returns>
         */
        public ActionParameter GetParameter(int _ID)
        {
            if (useParameters && parameters != null)
            {
                                #if UNITY_EDITOR
                if (!Application.isPlaying)
                {
                    foreach (ActionParameter parameter in parameters)
                    {
                        if (parameter.ID == _ID)
                        {
                            return(parameter);
                        }
                    }
                }
                                #endif

                if (runtimeParameters == null)
                {
                    runtimeParameters = new List <ActionParameter> ();
                }

                foreach (ActionParameter parameter in runtimeParameters)
                {
                    if (parameter.ID == _ID)
                    {
                        return(parameter);
                    }
                }

                foreach (ActionParameter parameter in parameters)
                {
                    if (parameter.ID == _ID)
                    {
                        ActionParameter newRuntimeParameter = new ActionParameter(parameter, true);
                        runtimeParameters.Add(newRuntimeParameter);
                        return(newRuntimeParameter);
                    }
                }
            }
            return(null);
        }
示例#25
0
        override public void AssignValues(List <ActionParameter> parameters)
        {
            if (!changeOwn)
            {
                if (actionListSource == ActionListSource.InScene)
                {
                    actionList = AssignFile <ActionList> (actionListConstantID, actionList);
                    if (actionList != null)
                    {
                        if (actionList.source == ActionListSource.AssetFile && actionList.assetFile != null)
                        {
                            if (actionList.syncParamValues && actionList.assetFile.useParameters)
                            {
                                _parameter = GetParameterWithID(actionList.assetFile.parameters, parameterID);
                            }
                            else
                            {
                                _parameter = GetParameterWithID(actionList.parameters, parameterID);
                            }
                        }
                        else if (actionList.source == ActionListSource.InScene && actionList.useParameters)
                        {
                            _parameter = GetParameterWithID(actionList.parameters, parameterID);
                        }
                    }
                }
                else if (actionListSource == ActionListSource.AssetFile)
                {
                    if (actionListAsset != null)
                    {
                        _parameter = GetParameterWithID(actionListAsset.parameters, parameterID);
                    }
                }
            }
            else
            {
                _parameter = GetParameterWithID(parameters, parameterID);
            }

            gameobjectValue = AssignFile(gameObjectConstantID, gameobjectValue);
        }
示例#26
0
        public static void ShowParametersGUI(List <ActionParameter> parameters)
        {
            int numParameters = parameters.Count;

            numParameters = EditorGUILayout.IntField("Number of parameters:", numParameters);
            if (numParameters < 0)
            {
                numParameters = 0;
            }

            if (numParameters < parameters.Count)
            {
                parameters.RemoveRange(numParameters, parameters.Count - numParameters);
            }
            else if (numParameters > parameters.Count)
            {
                if (numParameters > parameters.Capacity)
                {
                    parameters.Capacity = numParameters;
                }
                for (int i = parameters.Count; i < numParameters; i++)
                {
                    ActionParameter newParameter = new ActionParameter(ActionListEditor.GetParameterIDArray(parameters));
                    parameters.Add(newParameter);
                }
            }

            foreach (ActionParameter _parameter in parameters)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(_parameter.ID.ToString(), GUILayout.Width(10f));
                _parameter.label         = EditorGUILayout.TextField(_parameter.label);
                _parameter.parameterType = (ParameterType)EditorGUILayout.EnumPopup(_parameter.parameterType);
                if (GUILayout.Button("-"))
                {
                    parameters.Remove(_parameter);
                    break;
                }
                EditorGUILayout.EndHorizontal();
            }
        }
示例#27
0
        private int GetParamReferences(List <ActionParameter> parameters, int _ID, ParameterType _paramType)
        {
            if (setParamMethod == SetParamMethod.EnteredHere)
            {
                ActionParameter _param = null;

                if (changeOwn)
                {
                    if (parameters != null)
                    {
                        _param = GetParameterWithID(parameters, parameterID);
                    }
                }
                else
                {
                    if (actionListSource == ActionListSource.InScene && actionList != null)
                    {
                        if (actionList.source == ActionListSource.InScene && actionList.useParameters)
                        {
                            _param = GetParameterWithID(actionList.parameters, parameterID);
                        }
                        else if (actionList.source == ActionListSource.AssetFile && actionList.assetFile != null && actionList.assetFile.useParameters)
                        {
                            _param = GetParameterWithID(actionList.assetFile.parameters, parameterID);
                        }
                    }
                    else if (actionListSource == ActionListSource.AssetFile && actionListAsset != null && actionListAsset.useParameters)
                    {
                        _param = GetParameterWithID(actionListAsset.parameters, parameterID);
                    }
                }

                if (_param != null && _param.parameterType == _paramType && _ID == intValue)
                {
                    return(1);
                }
            }

            return(0);
        }
示例#28
0
        public static void ShowParametersGUI(ActionList actionList, ActionListAsset actionListAsset, List <ActionParameter> parameters)
        {
            foreach (ActionParameter _parameter in parameters)
            {
                EditorGUILayout.BeginHorizontal();

                if (Application.isPlaying)
                {
                    EditorGUILayout.LabelField(_parameter.ID.ToString() + ": " + _parameter.parameterType.ToString() + " '" + _parameter.label + "'");
                    EditorGUILayout.LabelField("Current value: '" + _parameter.GetLabel() + "'");
                }
                else
                {
                    EditorGUILayout.LabelField(_parameter.ID.ToString(), GUILayout.MaxWidth(10f));
                    _parameter.label         = EditorGUILayout.TextField(_parameter.label);
                    _parameter.parameterType = (ParameterType)EditorGUILayout.EnumPopup(_parameter.parameterType);

                    if (GUILayout.Button("", CustomStyles.IconCog))
                    {
                        ParameterSideMenu(actionList, actionListAsset, parameters.Count, parameters.IndexOf(_parameter));
                    }
                }

                EditorGUILayout.EndHorizontal();
            }

            if (!Application.isPlaying)
            {
                if (parameters.Count > 0)
                {
                    EditorGUILayout.Space();
                }

                if (GUILayout.Button("Create new parameter", EditorStyles.miniButton))
                {
                    ActionParameter newParameter = new ActionParameter(ActionListEditor.GetParameterIDArray(parameters));
                    parameters.Add(newParameter);
                }
            }
        }
示例#29
0
        private void ShowParametersGUI(ActionList _target)
        {
            if (_target is AC_Trigger)
            {
                if (_target.parameters.Count != 1)
                {
                    ActionParameter newParameter = new ActionParameter(0);
                    newParameter.parameterType = ParameterType.GameObject;
                    newParameter.label         = "Collision object";
                    _target.parameters.Clear();
                    _target.parameters.Add(newParameter);
                }
                return;
            }

            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Parameters", EditorStyles.boldLabel);
            ActionListEditor.ShowParametersGUI(_target.parameters);

            EditorGUILayout.EndVertical();
        }
示例#30
0
        /**
         * <summary>Replaces a GameObject based on an ActionParameter or ConstantID instance, if appropriate.</summary>
         * <param name = "parameters">A List of ActionParameters that may override the GameObject</param>
         * <param name = "_parameterID">The ID of the ActionParameter to search for within parameters that will replace the GameObject</param>
         * <param name = "field">The Object to replace</param>
         * <returns>The replaced Object, or field if no replacements were found</returns>
         */
        protected Object AssignObject <T> (List <ActionParameter> parameters, int _parameterID, Object field) where T : Object
        {
            Object          file      = field;
            ActionParameter parameter = GetParameterWithID(parameters, _parameterID);

            if (parameter != null && parameter.parameterType == ParameterType.UnityObject)
            {
                file = null;
                if (parameter.objectValue != null)
                {
                    if (parameter.objectValue is T)
                    {
                        file = parameter.objectValue;
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot convert " + parameter.objectValue.name + " to type '" + typeof(T) + "'");
                    }
                }
            }

            return(file);
        }
        public override int GetInventoryReferences(List <ActionParameter> parameters, int _invID)
        {
            if (setParamMethod == SetParamMethod.EnteredHere)
            {
                ActionParameter _param = null;

                if (changeOwn && parameters != null)
                {
                    _param = GetParameterWithID(parameters, parameterID);
                }
                else
                {
                    if (actionListSource == ActionListSource.InScene && actionList != null)
                    {
                        if (actionList.source == ActionListSource.InScene && actionList.useParameters)
                        {
                            _param = GetParameterWithID(actionList.parameters, parameterID);
                        }
                        else if (actionList.source == ActionListSource.AssetFile && actionList.assetFile != null && actionList.assetFile.useParameters)
                        {
                            _param = GetParameterWithID(actionList.assetFile.parameters, parameterID);
                        }
                    }
                    else if (actionListSource == ActionListSource.AssetFile && actionListAsset != null && actionListAsset.useParameters)
                    {
                        _param = GetParameterWithID(actionListAsset.parameters, parameterID);
                    }
                }

                if (_param != null && _param.parameterType == ParameterType.InventoryItem && _invID == intValue)
                {
                    return(1);
                }
            }

            return(0);
        }
示例#32
0
        private void ShowParametersGUI(ActionList _target)
        {
            if (_target is AC_Trigger)
            {
                if (_target.parameters.Count != 1)
                {
                    ActionParameter newParameter = new ActionParameter (0);
                    newParameter.parameterType = ParameterType.GameObject;
                    newParameter.label = "Collision object";
                    _target.parameters.Clear ();
                    _target.parameters.Add (newParameter);
                }
                return;
            }

            EditorGUILayout.Space ();
            EditorGUILayout.BeginVertical ("Button");
            EditorGUILayout.LabelField ("Parameters", EditorStyles.boldLabel);
            ActionListEditor.ShowParametersGUI (_target.parameters);

            EditorGUILayout.EndVertical ();
        }
        private void SetParametersGUI(List<ActionParameter> externalParameters, List<ActionParameter> ownParameters)
        {
            // Ensure target and local parameter lists match

            int numParameters = externalParameters.Count;
            if (numParameters < localParameters.Count)
            {
                localParameters.RemoveRange (numParameters, localParameters.Count - numParameters);
            }
            else if (numParameters > localParameters.Count)
            {
                if (numParameters > localParameters.Capacity)
                {
                    localParameters.Capacity = numParameters;
                }
                for (int i=localParameters.Count; i<numParameters; i++)
                {
                    ActionParameter newParameter = new ActionParameter (externalParameters [i].ID);
                    localParameters.Add (newParameter);
                }
            }

            if (numParameters < parameterIDs.Count)
            {
                parameterIDs.RemoveRange (numParameters, parameterIDs.Count - numParameters);
            }
            else if (numParameters > parameterIDs.Count)
            {
                if (numParameters > parameterIDs.Capacity)
                {
                    parameterIDs.Capacity = numParameters;
                }
                for (int i=parameterIDs.Count; i<numParameters; i++)
                {
                    parameterIDs.Add (-1);
                }
            }

            EditorGUILayout.BeginVertical ("Button");
            for (int i=0; i<externalParameters.Count; i++)
            {
                string label = externalParameters[i].label;
                int linkedID = parameterIDs[i];

                if (externalParameters[i].parameterType == ParameterType.GameObject)
                {
                    linkedID = Action.ChooseParameterGUI (label + ":", ownParameters, linkedID, ParameterType.GameObject);
                    if (linkedID < 0)
                    {
                        if (isAssetFile)
                        {
                            // ID
                            localParameters[i].intValue = EditorGUILayout.IntField (label + " (ID):", localParameters[i].intValue);
                            localParameters[i].gameObject = null;
                        }
                        else
                        {
                            /// Gameobject
                            localParameters[i].gameObject = (GameObject) EditorGUILayout.ObjectField (label + ":", localParameters[i].gameObject, typeof (GameObject), true);
                            localParameters[i].intValue = 0;
                            if (localParameters[i].gameObject != null && localParameters[i].gameObject.GetComponent <ConstantID>() == null)
                            {
                                localParameters[i].gameObject.AddComponent <ConstantID>();
                            }
                        }
                    }
                }
                else if (externalParameters[i].parameterType == ParameterType.GlobalVariable)
                {
                    if (AdvGame.GetReferences () && AdvGame.GetReferences ().variablesManager)
                    {
                        linkedID = Action.ChooseParameterGUI (label + ":", ownParameters, linkedID, ParameterType.GlobalVariable);
                        if (linkedID < 0)
                        {
                            VariablesManager variablesManager = AdvGame.GetReferences ().variablesManager;
                            localParameters[i].intValue = ShowVarSelectorGUI (label + ":", variablesManager.vars, localParameters[i].intValue);
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox ("A Variables Manager is required to pass Global Variables.", MessageType.Warning);
                    }
                }
                else if (externalParameters[i].parameterType == ParameterType.InventoryItem)
                {
                    if (AdvGame.GetReferences () && AdvGame.GetReferences ().inventoryManager)
                    {
                        linkedID = Action.ChooseParameterGUI (label + ":", ownParameters, linkedID, ParameterType.InventoryItem);
                        if (linkedID < 0)
                        {
                            InventoryManager inventoryManager = AdvGame.GetReferences ().inventoryManager;
                            localParameters[i].intValue = ShowInvItemSelectorGUI (label + ":", inventoryManager.items, localParameters[i].intValue);
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox ("An Inventory Manager is required to pass Inventory items.", MessageType.Warning);
                    }
                }
                else if (externalParameters[i].parameterType == ParameterType.LocalVariable)
                {
                    if (KickStarter.localVariables)
                    {
                        linkedID = Action.ChooseParameterGUI (label + ":", ownParameters, linkedID, ParameterType.LocalVariable);
                        if (linkedID < 0)
                        {
                            localParameters[i].intValue = ShowVarSelectorGUI (label + ":", KickStarter.localVariables.localVars, localParameters[i].intValue);
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox ("A GameEngine prefab is required to pass Local Variables.", MessageType.Warning);
                    }
                }
                else if (externalParameters[i].parameterType == ParameterType.String)
                {
                    linkedID = Action.ChooseParameterGUI (label + ":", ownParameters, linkedID, ParameterType.String);
                    if (linkedID < 0)
                    {
                        EditorGUILayout.BeginHorizontal ();
                        EditorGUILayout.LabelField (label + ":", GUILayout.Width (145f));
                        EditorStyles.textField.wordWrap = true;
                        localParameters[i].stringValue = EditorGUILayout.TextArea (localParameters[i].stringValue, GUILayout.MaxWidth (400f));
                        EditorGUILayout.EndHorizontal ();
                    }
                }
                else if (externalParameters[i].parameterType == ParameterType.Float)
                {
                    linkedID = Action.ChooseParameterGUI (label + ":", ownParameters, linkedID, ParameterType.Float);
                    if (linkedID < 0)
                    {
                        localParameters[i].floatValue = EditorGUILayout.FloatField (label + ":", localParameters[i].floatValue);
                    }
                }
                else if (externalParameters[i].parameterType == ParameterType.Integer)
                {
                    linkedID = Action.ChooseParameterGUI (label + ":", ownParameters, linkedID, ParameterType.Integer);
                    if (linkedID < 0)
                    {
                        localParameters[i].intValue = EditorGUILayout.IntField (label + ":", localParameters[i].intValue);
                    }
                }
                else if (externalParameters[i].parameterType == ParameterType.Boolean)
                {
                    linkedID = Action.ChooseParameterGUI (label + ":", ownParameters, linkedID, ParameterType.Boolean);
                    if (linkedID < 0)
                    {
                        BoolValue boolValue = BoolValue.False;
                        if (localParameters[i].intValue == 1)
                        {
                            boolValue = BoolValue.True;
                        }

                        boolValue = (BoolValue) EditorGUILayout.EnumPopup (label + ":", boolValue);

                        if (boolValue == BoolValue.True)
                        {
                            localParameters[i].intValue = 1;
                        }
                        else
                        {
                            localParameters[i].intValue = 0;
                        }
                    }
                }

                parameterIDs[i] = linkedID;
            }
            EditorGUILayout.EndVertical ();
        }
示例#34
0
        public static void ShowParametersGUI(List<ActionParameter> parameters)
        {
            int numParameters = parameters.Count;
            numParameters = EditorGUILayout.IntField ("Number of parameters:", numParameters);
            if (numParameters < 0)
            {
                numParameters = 0;
            }

            if (numParameters < parameters.Count)
            {
                parameters.RemoveRange (numParameters, parameters.Count - numParameters);
            }
            else if (numParameters > parameters.Count)
            {
                if (numParameters > parameters.Capacity)
                {
                    parameters.Capacity = numParameters;
                }
                for (int i=parameters.Count; i<numParameters; i++)
                {
                    ActionParameter newParameter = new ActionParameter (ActionListEditor.GetParameterIDArray (parameters));
                    parameters.Add (newParameter);
                }
            }

            foreach (ActionParameter _parameter in parameters)
            {
                EditorGUILayout.BeginHorizontal ();
                EditorGUILayout.LabelField (_parameter.ID.ToString (), GUILayout.Width (10f));
                _parameter.label = EditorGUILayout.TextField (_parameter.label);
                _parameter.parameterType = (ParameterType) EditorGUILayout.EnumPopup (_parameter.parameterType);
                if (GUILayout.Button ("-"))
                {
                    parameters.Remove (_parameter);
                    break;
                }
                EditorGUILayout.EndHorizontal ();
            }
        }
		private void SetParametersGUI (List<ActionParameter> externalParameters)
		{
			// Ensure target and local parameter lists match
			
			int numParameters = externalParameters.Count;
			if (numParameters < localParameters.Count)
			{
				localParameters.RemoveRange (numParameters, localParameters.Count - numParameters);
			}
			else if (numParameters > localParameters.Count)
			{
				if (numParameters > localParameters.Capacity)
				{
					localParameters.Capacity = numParameters;
				}
				for (int i=localParameters.Count; i<numParameters; i++)
				{
					ActionParameter newParameter = new ActionParameter (externalParameters [i].ID);
					localParameters.Add (newParameter);
				}
			}

			EditorGUILayout.BeginVertical ("Button");
			for (int i=0; i<externalParameters.Count; i++)
			{
				string label = externalParameters[i].label;
				
				if (externalParameters[i].parameterType == ParameterType.GameObject)
				{
					if (isAssetFile)
					{
						// ID
						localParameters[i].intValue = EditorGUILayout.IntField (label + " (ID):", localParameters[i].intValue);
						localParameters[i].gameObject = null;
					}
					else
					{
						/// Gameobject
						localParameters[i].gameObject = (GameObject) EditorGUILayout.ObjectField (label + ":", localParameters[i].gameObject, typeof (GameObject), true);
						localParameters[i].intValue = 0;
					}
				}
				else if (externalParameters[i].parameterType == ParameterType.GlobalVariable)
				{
					if (AdvGame.GetReferences () && AdvGame.GetReferences ().variablesManager)
					{
						VariablesManager variablesManager = AdvGame.GetReferences ().variablesManager;
						localParameters[i].intValue = ShowVarSelectorGUI (label + ":", variablesManager.vars, localParameters[i].intValue);
					}
					else
					{
						EditorGUILayout.HelpBox ("A Variables Manager is required to pass Global Variables.", MessageType.Warning);
					}
				}
				else if (externalParameters[i].parameterType == ParameterType.InventoryItem)
				{
					if (AdvGame.GetReferences () && AdvGame.GetReferences ().inventoryManager)
					{
						InventoryManager inventoryManager = AdvGame.GetReferences ().inventoryManager;
						localParameters[i].intValue = ShowInvItemSelectorGUI (label + ":", inventoryManager.items, localParameters[i].intValue);
					}
					else
					{
						EditorGUILayout.HelpBox ("An Inventory Manager is required to pass Inventory items.", MessageType.Warning);
					}
				}
				else if (externalParameters[i].parameterType == ParameterType.LocalVariable)
				{
					if (GameObject.FindWithTag (Tags.gameEngine) && GameObject.FindWithTag (Tags.gameEngine).GetComponent <LocalVariables>())
					{
						LocalVariables localVariables = GameObject.FindWithTag (Tags.gameEngine).GetComponent <LocalVariables>();
						localParameters[i].intValue = ShowVarSelectorGUI (label + ":", localVariables.localVars, localParameters[i].intValue);
					}
					else
					{
						EditorGUILayout.HelpBox ("A GameEngine prefab is required to pass Local Variables.", MessageType.Warning);
					}
				}
				else if (externalParameters[i].parameterType == ParameterType.String)
				{
					localParameters[i].stringValue = EditorGUILayout.TextField (label + ":", localParameters[i].stringValue);
				}
				else if (externalParameters[i].parameterType == ParameterType.Float)
				{
					localParameters[i].floatValue = EditorGUILayout.FloatField (label + ":", localParameters[i].floatValue);
				}
				else if (externalParameters[i].parameterType == ParameterType.Integer)
				{
					localParameters[i].intValue = EditorGUILayout.IntField (label + ":", localParameters[i].intValue);
				}
				else if (externalParameters[i].parameterType == ParameterType.Boolean)
				{
					BoolValue boolValue = BoolValue.False;
					if (localParameters[i].intValue == 1)
					{
						boolValue = BoolValue.True;
					}

					boolValue = (BoolValue) EditorGUILayout.EnumPopup (label + ":", boolValue);

					if (boolValue == BoolValue.True)
					{
						localParameters[i].intValue = 1;
					}
					else
					{
						localParameters[i].intValue = 0;
					}
				}
			}
			EditorGUILayout.EndVertical ();
		}
示例#36
0
        private void ShowVarGUI(List<ActionParameter> parameters, ActionParameter parameter)
        {
            if (parameters == null || parameters.Count == 0 || parameter == null)
            {
                EditorGUILayout.HelpBox ("No parameters exist! Please define one in the Inspector.", MessageType.Warning);
                parameterLabel = "";
                return;
            }

            parameterLabel = parameter.label;
            EditorGUILayout.BeginHorizontal ();

            if (parameter.parameterType == ParameterType.Boolean)
            {
                boolCondition = (BoolCondition) EditorGUILayout.EnumPopup (boolCondition);
                boolValue = (BoolValue) EditorGUILayout.EnumPopup (boolValue);
            }
            else if (parameter.parameterType == ParameterType.Integer)
            {
                intCondition = (IntCondition) EditorGUILayout.EnumPopup (intCondition);
                intValue = EditorGUILayout.IntField (intValue);
            }
            else if (parameter.parameterType == ParameterType.Float)
            {
                intCondition = (IntCondition) EditorGUILayout.EnumPopup (intCondition);
                floatValue = EditorGUILayout.FloatField (floatValue);
            }
            else if (parameter.parameterType == ParameterType.String)
            {
                boolCondition = (BoolCondition) EditorGUILayout.EnumPopup (boolCondition);
                stringValue = EditorGUILayout.TextField (stringValue);
            }
            else if (parameter.parameterType == ParameterType.GameObject)
            {
                compareObject = (GameObject) EditorGUILayout.ObjectField ("Is equal to:", compareObject, typeof (GameObject), true);

                compareObjectConstantID = FieldToID (compareObject, compareObjectConstantID);
                compareObject = IDToField (compareObject, compareObjectConstantID, false);
            }
            else if (parameter.parameterType == ParameterType.GlobalVariable)
            {
                if (AdvGame.GetReferences ().variablesManager == null || AdvGame.GetReferences ().variablesManager.vars == null || AdvGame.GetReferences ().variablesManager.vars.Count == 0)
                {
                    EditorGUILayout.HelpBox ("No Global variables exist!", MessageType.Info);
                }
                else
                {
                    compareVariableID = ShowVarSelectorGUI (AdvGame.GetReferences ().variablesManager.vars, compareVariableID);
                }
            }
            else if (parameter.parameterType == ParameterType.InventoryItem)
            {
                ShowInvSelectorGUI (compareVariableID);
            }
            else if (parameter.parameterType == ParameterType.LocalVariable)
            {
                if (isAssetFile)
                {
                    EditorGUILayout.HelpBox ("Cannot compare local variables in an asset file.", MessageType.Warning);
                }
                else if (KickStarter.localVariables == null || KickStarter.localVariables.localVars == null || KickStarter.localVariables.localVars.Count == 0)
                {
                    EditorGUILayout.HelpBox ("No Local variables exist!", MessageType.Info);
                }
                else
                {
                    compareVariableID = ShowVarSelectorGUI (KickStarter.localVariables.localVars, compareVariableID);
                }
            }

            EditorGUILayout.EndHorizontal ();
        }
示例#37
0
 public override void AssignValues(List<ActionParameter> parameters)
 {
     _parameter = GetParameterWithID (parameters, parameterID);
     compareObject = AssignFile (compareObjectConstantID, compareObject);
 }
示例#38
0
        /**
         * <summary>A Constructor that duplicates another ActionParameter.</summary>
         */
        public ActionParameter(ActionParameter _actionParameter)
        {
            label = _actionParameter.label;
            ID = _actionParameter.ID;
            parameterType = _actionParameter.parameterType;

            intValue = -1;
            floatValue = 0f;
            stringValue = "";
            gameObject = null;
        }
示例#39
0
 /**
  * <summary>Copies the "value" variables from another ActionParameter, without changing the type, ID, or label.</summary>
  * <parameter name = "otherParameter">The ActionParameter to copy from</param>
  */
 public void CopyValues(ActionParameter otherParameter)
 {
     intValue = otherParameter.intValue;
     floatValue = otherParameter.floatValue;
     stringValue = otherParameter.stringValue;
     gameObject = otherParameter.gameObject;
 }