private void ShowNodeCommandGUI(Paths _target, int i)
        {
            if (_target.nodeCommands.Count > i)
            {
                if (_target.commandSource == ActionListSource.InScene)
                {
                    _target.nodeCommands[i].cutscene = ActionListAssetMenu.CutsceneGUI("Cutscene on reach:", _target.nodeCommands[i].cutscene, _target.name + "_OnReachNode_" + i.ToString(), "", "The Cutscene to run when the node is reached");

                    if (_target.nodeCommands[i].cutscene != null && _target.nodeCommands[i].cutscene.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].cutscene.parameters, _target.nodeCommands[i].parameterID);
                    }
                }
                else
                {
                    _target.nodeCommands[i].actionListAsset = ActionListAssetMenu.AssetGUI("ActionList on reach:", _target.nodeCommands[i].actionListAsset, _target.name + "_OnReachNode_" + i.ToString(), "", "The ActionList asset to run when the node is reached");

                    if (_target.nodeCommands[i].actionListAsset != null && _target.nodeCommands[i].actionListAsset.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].actionListAsset.parameters, _target.nodeCommands[i].parameterID);
                    }
                }

                if ((_target.commandSource == ActionListSource.InScene && _target.nodeCommands[i].cutscene != null) ||
                    (_target.commandSource == ActionListSource.AssetFile && _target.nodeCommands[i].actionListAsset != null))
                {
                    _target.nodeCommands[i].pausesCharacter = CustomGUILayout.Toggle("Character waits during?", _target.nodeCommands[i].pausesCharacter, string.Empty, "If True, then the character moving along the path will stop moving while the cutscene is run");
                }
            }
        }
Example #2
0
        private void ArrowGUI(Arrow arrow, ActionListSource source, string label)
        {
            if (arrow != null)
            {
                ArrowPrompt _target = (ArrowPrompt)target;

                arrow.isPresent = CustomGUILayout.Toggle("Provide?", arrow.isPresent, "", "If True, the Arrow is defined and used in the ArrowPrompt");

                if (arrow.isPresent)
                {
                    arrow.texture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Icon texture:", arrow.texture, true, "", "The texture to draw on-screen");

                    EditorGUILayout.BeginHorizontal();
                    if (source == ActionListSource.InScene)
                    {
                        arrow.linkedCutscene = ActionListAssetMenu.CutsceneGUI("Linked Cutscene", arrow.linkedCutscene, _target.gameObject.name + ": " + label, "The Cutscene to run when the Arrow is triggered");
                    }
                    else if (source == ActionListSource.AssetFile)
                    {
                        arrow.linkedActionList = ActionListAssetMenu.AssetGUI("Linked ActionList:", arrow.linkedActionList, _target.gameObject.name + "_" + label, "", "The ActionList asset to run when the Arrow is triggered");
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }
        }
Example #3
0
        override public void SkipActionGUI(List <Action> actions, bool showGUI)
        {
            if (numSockets < 0)
            {
                numSockets = 0;
            }

            if (numSockets < endings.Count)
            {
                endings.RemoveRange(numSockets, endings.Count - numSockets);
            }
            else if (numSockets > endings.Count)
            {
                if (numSockets > endings.Capacity)
                {
                    endings.Capacity = numSockets;
                }
                for (int i = endings.Count; i < numSockets; i++)
                {
                    ActionEnd newEnd = new ActionEnd();
                    newEnd.resultAction = ResultAction.Stop;
                    endings.Add(newEnd);
                }
            }

            foreach (ActionEnd ending in endings)
            {
                if (showGUI)
                {
                    EditorGUILayout.Space();
                    int i = endings.IndexOf(ending) + 1;
                    ending.resultAction = (ResultAction)EditorGUILayout.EnumPopup(GetSocketLabel(i), (ResultAction)ending.resultAction);
                }

                if (ending.resultAction == ResultAction.RunCutscene && showGUI)
                {
                    if (isAssetFile)
                    {
                        ending.linkedAsset = ActionListAssetMenu.AssetGUI("ActionList to run:", ending.linkedAsset);
                    }
                    else
                    {
                        ending.linkedCutscene = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", ending.linkedCutscene);
                    }
                }
                else if (ending.resultAction == ResultAction.Skip)
                {
                    SkipActionGUI(ending, actions, showGUI);
                }

                /*else
                 * {
                 *      EditorGUILayout.Space ();
                 *      EditorGUILayout.Space ();
                 *      EditorGUILayout.Space ();
                 * }*/
            }
        }
Example #4
0
        protected void AfterRunningOption()
        {
            EditorGUILayout.Space();
            endAction = (ResultAction)EditorGUILayout.EnumPopup("After running:", (ResultAction)endAction);

            if (endAction == ResultAction.RunCutscene)
            {
                if (isAssetFile)
                {
                    linkedAsset = ActionListAssetMenu.AssetGUI("ActionList to run:", linkedAsset);
                }
                else
                {
                    linkedCutscene = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", linkedCutscene);
                }
            }
        }
        override public void SkipActionGUI(List <Action> actions, bool showGUI)
        {
            if (showGUI)
            {
                EditorGUILayout.Space();
                resultActionTrue = (ResultAction)EditorGUILayout.EnumPopup("If condition is met:", (ResultAction)resultActionTrue);
            }
            if (resultActionTrue == ResultAction.RunCutscene && showGUI)
            {
                if (isAssetFile)
                {
                    linkedAssetTrue = ActionListAssetMenu.AssetGUI("ActionList to run:", linkedAssetTrue);
                }
                else
                {
                    linkedCutsceneTrue = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", linkedCutsceneTrue);
                }
            }
            else if (resultActionTrue == ResultAction.Skip)
            {
                SkipActionTrueGUI(actions, showGUI);
            }

            if (showGUI)
            {
                resultActionFail = (ResultAction)EditorGUILayout.EnumPopup("If condition is not met:", (ResultAction)resultActionFail);
            }
            if (resultActionFail == ResultAction.RunCutscene && showGUI)
            {
                if (isAssetFile)
                {
                    linkedAssetFail = ActionListAssetMenu.AssetGUI("ActionList to run:", linkedAssetFail);
                }
                else
                {
                    linkedCutsceneFail = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", linkedCutsceneFail);
                }
            }
            else if (resultActionFail == ResultAction.Skip)
            {
                SkipActionFailGUI(actions, showGUI);
            }
        }
Example #6
0
        private void ShowNodeCommandGUI(Paths _target, int i)
        {
            if (_target.nodeCommands.Count > i)
            {
                if (_target.commandSource == ActionListSource.InScene)
                {
                    _target.nodeCommands[i].cutscene = ActionListAssetMenu.CutsceneGUI("Cutscene on reach:", _target.nodeCommands[i].cutscene);

                    if (_target.nodeCommands[i].cutscene != null && _target.nodeCommands[i].cutscene.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].cutscene.parameters, _target.nodeCommands[i].parameterID);
                    }
                }
                else
                {
                    _target.nodeCommands[i].actionListAsset = ActionListAssetMenu.AssetGUI("ActionList on reach:", _target.nodeCommands[i].actionListAsset);

                    if (_target.nodeCommands[i].actionListAsset != null && _target.nodeCommands[i].actionListAsset.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].actionListAsset.parameters, _target.nodeCommands[i].parameterID);
                    }
                }
            }
        }
Example #7
0
        private void ShowNodeCommandGUI(Paths _target, int i)
        {
            if (_target.nodeCommands.Count > i)
            {
                if (_target.commandSource == ActionListSource.InScene)
                {
                    _target.nodeCommands[i].cutscene = ActionListAssetMenu.CutsceneGUI("Cutscene on reach:", _target.nodeCommands[i].cutscene, _target.name + "_OnReachNode_" + i.ToString(), "", "The Cutscene to run when the node is reached");

                    if (_target.nodeCommands[i].cutscene != null && _target.nodeCommands[i].cutscene.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].cutscene.parameters, _target.nodeCommands[i].parameterID);
                    }
                }
                else
                {
                    _target.nodeCommands[i].actionListAsset = ActionListAssetMenu.AssetGUI("ActionList on reach:", _target.nodeCommands[i].actionListAsset, _target.name + "_OnReachNode_" + i.ToString(), "", "The ActionList asset to run when the node is reached");

                    if (_target.nodeCommands[i].actionListAsset != null && _target.nodeCommands[i].actionListAsset.useParameters)
                    {
                        _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].actionListAsset.parameters, _target.nodeCommands[i].parameterID);
                    }
                }
            }
        }
Example #8
0
        override public void SkipActionGUI(List <Action> actions, bool showGUI)
        {
            if (numSockets < 0)
            {
                numSockets = 0;
            }

            if (numSockets < endings.Count)
            {
                endings.RemoveRange(numSockets, endings.Count - numSockets);
            }
            else if (numSockets > endings.Count)
            {
                if (numSockets > endings.Capacity)
                {
                    endings.Capacity = numSockets;
                }
                for (int i = endings.Count; i < numSockets; i++)
                {
                    ActionEnd newEnd = new ActionEnd();
                    endings.Add(newEnd);
                }
            }

            foreach (ActionEnd ending in endings)
            {
                if (showGUI)
                {
                    EditorGUILayout.Space();
                    int i = endings.IndexOf(ending) + 1;
                    ending.resultAction = (ResultAction)EditorGUILayout.EnumPopup("Output " + i.ToString() + ":", (ResultAction)ending.resultAction);
                }

                if (ending.resultAction == ResultAction.RunCutscene && showGUI)
                {
                    if (isAssetFile)
                    {
                        ending.linkedAsset = ActionListAssetMenu.AssetGUI("ActionList to run:", ending.linkedAsset);
                    }
                    else
                    {
                        ending.linkedCutscene = ActionListAssetMenu.CutsceneGUI("Cutscene to run:", ending.linkedCutscene);
                    }
                }
                else if (ending.resultAction == ResultAction.Skip)
                {
                    SkipActionGUI(ending, actions, showGUI);
                }
            }

            bool       shownError    = false;
            List <int> outputIndices = new List <int>();

            foreach (ActionEnd ending in endings)
            {
                if (ending.resultAction == ResultAction.Skip)
                {
                    if (outputIndices.Contains(ending.skipAction))
                    {
                        if (!shownError)
                        {
                            EditorGUILayout.HelpBox("Two or more output sockets connect to the same subsequent Action - this may cause unexpected behaviour and should be changed.", MessageType.Warning);
                        }
                        shownError = true;
                    }
                    else
                    {
                        outputIndices.Add(ending.skipAction);
                    }
                }
            }
        }
Example #9
0
        public override void OnInspectorGUI()
        {
            Paths _target = (Paths)target;

            if (_target.GetComponent <AC.Char>())
            {
                return;
            }

            int numNodes = _target.nodes.Count;

            if (numNodes < 1)
            {
                numNodes      = 1;
                _target.nodes = ResizeList(_target.nodes, numNodes);
            }

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.LabelField("Path properties", EditorStyles.boldLabel);
            _target.nodePause = EditorGUILayout.FloatField("Wait time (s):", _target.nodePause);
            _target.pathSpeed = (PathSpeed)EditorGUILayout.EnumPopup("Walk or run:", (PathSpeed)_target.pathSpeed);
            _target.pathType  = (AC_PathType)EditorGUILayout.EnumPopup("Path type:", (AC_PathType)_target.pathType);
            if (_target.pathType == AC_PathType.Loop)
            {
                _target.teleportToStart = EditorGUILayout.Toggle("Teleports when looping?", _target.teleportToStart);
            }
            _target.affectY       = EditorGUILayout.Toggle("Override gravity?", _target.affectY);
            _target.commandSource = (ActionListSource)EditorGUILayout.EnumPopup("Node commands source:", _target.commandSource);
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            // List nodes
            ResetCommandList(_target);
            for (int i = 1; i < _target.nodes.Count; i++)
            {
                EditorGUILayout.BeginVertical("Button");
                EditorGUILayout.BeginHorizontal();
                _target.nodes[i] = EditorGUILayout.Vector3Field("Node " + i + ": ", _target.nodes[i]);

                if (GUILayout.Button(insertContent, EditorStyles.miniButtonLeft, buttonWidth))
                {
                    Undo.RecordObject(_target, "Add path node");
                    Vector3 newNodePosition;
                    newNodePosition = _target.nodes[i] + new Vector3(1.0f, 0f, 0f);
                    _target.nodes.Insert(i + 1, newNodePosition);
                    _target.nodeCommands.Insert(i + 1, new NodeCommand());
                    numNodes += 1;
                    ResetCommandList(_target);
                }
                if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(_target, "Delete path node");
                    _target.nodes.RemoveAt(i);
                    _target.nodeCommands.RemoveAt(i);
                    numNodes -= 1;
                    ResetCommandList(_target);
                }
                EditorGUILayout.EndHorizontal();
                if (_target.nodeCommands.Count > i)
                {
                    if (_target.commandSource == ActionListSource.InScene)
                    {
                        _target.nodeCommands[i].cutscene = ActionListAssetMenu.CutsceneGUI("Cutscene on reach:", _target.nodeCommands[i].cutscene);

                        if (_target.nodeCommands[i].cutscene != null && _target.nodeCommands[i].cutscene.useParameters)
                        {
                            _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].cutscene.parameters, _target.nodeCommands[i].parameterID);
                        }
                    }
                    else
                    {
                        _target.nodeCommands[i].actionListAsset = ActionListAssetMenu.AssetGUI("ActionList on reach:", _target.nodeCommands[i].actionListAsset);

                        if (_target.nodeCommands[i].actionListAsset != null && _target.nodeCommands[i].actionListAsset.useParameters)
                        {
                            _target.nodeCommands[i].parameterID = SetParametersGUI(_target.nodeCommands[i].actionListAsset.parameters, _target.nodeCommands[i].parameterID);
                        }
                    }
                }
                EditorGUILayout.EndVertical();
            }

            if (numNodes == 1 && GUILayout.Button("Add node"))
            {
                Undo.RecordObject(_target, "Add path node");
                numNodes += 1;
            }

            _target.nodes[0] = _target.transform.position;
            _target.nodes    = ResizeList(_target.nodes, numNodes);

            UnityVersionHandler.CustomSetDirty(_target);
        }