示例#1
0
    public override void OnInspectorGUI()
    {
        SortingMap _target = (SortingMap)target;

        EditorGUILayout.BeginVertical("Button");
        _target.mapType     = (SortingMapType)EditorGUILayout.EnumPopup("Affect sprite's:", _target.mapType);
        _target.affectScale = EditorGUILayout.Toggle("Affect Character scale?", _target.affectScale);
        if (_target.affectScale)
        {
            _target.affectSpeed = EditorGUILayout.Toggle("Affect Character speed?", _target.affectSpeed);
            _target.originScale = EditorGUILayout.IntField("Start scale (%):", _target.originScale);
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.Space();

        foreach (SortingArea area in _target.sortingAreas)
        {
            int i = _target.sortingAreas.IndexOf(area);

            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.BeginHorizontal();

            area.color = EditorGUILayout.ColorField(area.color);

            EditorGUILayout.LabelField("Position:", GUILayout.Width(50f));
            area.z = EditorGUILayout.FloatField(area.z, GUILayout.Width(80f));

            if (_target.mapType == SortingMapType.OrderInLayer)
            {
                EditorGUILayout.LabelField("Order:", labelWidth);
                area.order = EditorGUILayout.IntField(area.order);
            }
            else if (_target.mapType == SortingMapType.SortingLayer)
            {
                EditorGUILayout.LabelField("Layer:", labelWidth);
                area.layer = EditorGUILayout.TextField(area.layer);
            }

            if (GUILayout.Button(insertContent, EditorStyles.miniButtonLeft, buttonWidth))
            {
                Undo.RecordObject(_target, "Add area");
                if (i < _target.sortingAreas.Count - 1)
                {
                    _target.sortingAreas.Insert(i + 1, new SortingArea(area, _target.sortingAreas[i + 1]));
                }
                else
                {
                    _target.sortingAreas.Insert(i + 1, new SortingArea(area));
                }
                break;
            }
            if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
            {
                Undo.RecordObject(_target, "Delete area");
                _target.sortingAreas.Remove(area);
                break;
            }

            EditorGUILayout.EndHorizontal();

            if (_target.affectScale)
            {
                area.scale = EditorGUILayout.IntField("End scale (%):", area.scale);
            }

            EditorGUILayout.EndVertical();
        }

        if (GUILayout.Button("Add area"))
        {
            Undo.RecordObject(_target, "Add area");

            if (_target.sortingAreas.Count > 0)
            {
                SortingArea lastArea = _target.sortingAreas [_target.sortingAreas.Count - 1];
                _target.sortingAreas.Add(new SortingArea(lastArea));
            }
            else
            {
                _target.sortingAreas.Add(new SortingArea(_target.transform.position.z + 1f, 1));
            }
        }

        EditorGUILayout.Space();

        if (AdvGame.GetReferences() && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.IsTopDown())
        {
        }
        else if (AdvGame.GetReferences() && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.IsUnity2D())
        {
        }
        else
        {
            if (GUILayout.Button("Face active camera"))
            {
                Undo.RecordObject(_target, "Face active camera");
                Vector3 forwardVector = Camera.main.transform.forward;
                _target.transform.forward = -forwardVector;
                EditorUtility.SetDirty(_target);
            }
        }

        if (_target.affectScale && _target.sortingAreas.Count > 1)
        {
            if (GUILayout.Button("Interpolate in-between scales"))
            {
                Undo.RecordObject(_target, "Interpolate scales");
                _target.SetInBetweenScales();
                EditorUtility.SetDirty(_target);
            }
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(_target);
        }
    }
示例#2
0
 private void GetReferences()
 {
     settingsManager = AdvGame.GetReferences().settingsManager;
 }
示例#3
0
    public override void CharSettingsGUI()
    {
                #if UNITY_EDITOR
        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Mecanim parameters:", EditorStyles.boldLabel);

        if (AdvGame.GetReferences() && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.IsTopDown())
        {
            character.spriteChild = (Transform)EditorGUILayout.ObjectField("Animator child:", character.spriteChild, typeof(Transform), true);
        }
        else
        {
            character.spriteChild = null;
        }

        character.moveSpeedParameter = EditorGUILayout.TextField("Move speed float:", character.moveSpeedParameter);
        character.turnParameter      = EditorGUILayout.TextField("Turn float:", character.turnParameter);
        character.talkParameter      = EditorGUILayout.TextField("Talk bool:", character.talkParameter);

        if (AdvGame.GetReferences() && AdvGame.GetReferences().speechManager&&
            AdvGame.GetReferences().speechManager.lipSyncMode != LipSyncMode.Off && AdvGame.GetReferences().speechManager.lipSyncMode != LipSyncMode.FaceFX)
        {
            if (AdvGame.GetReferences().speechManager.lipSyncOutput == LipSyncOutput.PortraitAndGameObject)
            {
                if (character.GetShapeable())
                {
                    character.lipSyncGroupID = ActionBlendShape.ShapeableGroupGUI("Phoneme shape group:", character.GetShapeable().shapeGroups, character.lipSyncGroupID);
                }
                else
                {
                    EditorGUILayout.HelpBox("Attach a Shapeable script to show phoneme options", MessageType.Info);
                }
            }
            else if (AdvGame.GetReferences().speechManager.lipSyncOutput == LipSyncOutput.GameObjectTexture)
            {
                if (character.GetComponent <LipSyncTexture>() == null)
                {
                    EditorGUILayout.HelpBox("Attach a LipSyncTexture script to allow texture lip-syncing.", MessageType.Info);
                }
            }
        }

        if (!character.ikHeadTurning)
        {
            character.headYawParameter   = EditorGUILayout.TextField("Head yaw float:", character.headYawParameter);
            character.headPitchParameter = EditorGUILayout.TextField("Head pitch float:", character.headPitchParameter);
        }

        character.verticalMovementParameter = EditorGUILayout.TextField("Vertical movement float:", character.verticalMovementParameter);
        if (character is Player)
        {
            Player player = (Player)character;
            player.jumpParameter = EditorGUILayout.TextField("Jump bool:", player.jumpParameter);
        }
        character.talkingAnimation = TalkingAnimation.Standard;

        EditorGUILayout.EndVertical();
        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Mecanim settings:", EditorStyles.boldLabel);

        character.headLayer  = EditorGUILayout.IntField("Head layer #:", character.headLayer);
        character.mouthLayer = EditorGUILayout.IntField("Mouth layer #:", character.mouthLayer);

        character.ikHeadTurning = EditorGUILayout.Toggle("IK head-turning?", character.ikHeadTurning);
        if (character.ikHeadTurning)
        {
                        #if UNITY_5 || UNITY_PRO
            EditorGUILayout.HelpBox("'IK Pass' must be enabled for this character's Base layer.", MessageType.Info);
                        #else
            EditorGUILayout.HelpBox("This features is only available with Unity 5 or Unity Pro.", MessageType.Info);
                        #endif
        }

        character.relyOnRootMotion  = EditorGUILayout.BeginToggleGroup("Rely on Root Motion?", character.relyOnRootMotion);
        character.rootTurningFactor = EditorGUILayout.Slider("Root Motion turning:", character.rootTurningFactor, 0f, 1f);
        EditorGUILayout.EndToggleGroup();
        character.doWallReduction = EditorGUILayout.BeginToggleGroup("Slow movement near wall colliders?", character.doWallReduction);
        character.wallLayer       = EditorGUILayout.TextField("Wall collider layer:", character.wallLayer);
        character.wallDistance    = EditorGUILayout.Slider("Collider distance:", character.wallDistance, 0f, 2f);
        EditorGUILayout.EndToggleGroup();

        EditorGUILayout.EndVertical();
        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Bone transforms:", EditorStyles.boldLabel);

        character.neckBone      = (Transform)EditorGUILayout.ObjectField("Neck bone:", character.neckBone, typeof(Transform), true);
        character.leftHandBone  = (Transform)EditorGUILayout.ObjectField("Left hand:", character.leftHandBone, typeof(Transform), true);
        character.rightHandBone = (Transform)EditorGUILayout.ObjectField("Right hand:", character.rightHandBone, typeof(Transform), true);
        EditorGUILayout.EndVertical();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(character);
        }
                #endif
    }
示例#4
0
    private void GetLinesFromInventory(bool onlySeekNew)
    {
        inventoryManager = AdvGame.GetReferences().inventoryManager;

        if (inventoryManager)
        {
            // Unhandled combine
            if (inventoryManager.unhandledCombine != null)
            {
                foreach (Action action in inventoryManager.unhandledCombine.actions)
                {
                    if (action is ActionSpeech)
                    {
                        ExtractLine(action as ActionSpeech, onlySeekNew, false);
                    }
                }
                EditorUtility.SetDirty(inventoryManager.unhandledCombine);
            }

            // Unhandled hotspot
            if (inventoryManager.unhandledHotspot != null)
            {
                foreach (Action action in inventoryManager.unhandledHotspot.actions)
                {
                    if (action is ActionSpeech)
                    {
                        ExtractLine(action as ActionSpeech, onlySeekNew, false);
                    }
                }
                EditorUtility.SetDirty(inventoryManager.unhandledHotspot);
            }

            // Item-specific events
            if (inventoryManager.items.Count > 0)
            {
                foreach (InvItem item in inventoryManager.items)
                {
                    // Use
                    if (item.useActionList != null)
                    {
                        foreach (Action action in item.useActionList.actions)
                        {
                            if (action is ActionSpeech)
                            {
                                ExtractLine(action as ActionSpeech, onlySeekNew, false);
                            }
                        }
                        EditorUtility.SetDirty(item.useActionList);
                    }

                    // Look
                    if (item.lookActionList)
                    {
                        foreach (Action action in item.lookActionList.actions)
                        {
                            if (action is ActionSpeech)
                            {
                                ExtractLine(action as ActionSpeech, onlySeekNew, false);
                            }
                        }
                        EditorUtility.SetDirty(item.lookActionList);
                    }

                    // Combines
                    foreach (InvActionList actionList in item.combineActionList)
                    {
                        if (actionList != null)
                        {
                            foreach (Action action in actionList.actions)
                            {
                                if (action is ActionSpeech)
                                {
                                    ExtractLine(action as ActionSpeech, onlySeekNew, false);
                                }
                            }
                            EditorUtility.SetDirty(actionList);
                        }
                    }
                }
            }
        }
    }
示例#5
0
    protected void DrawSharedElements()
    {
        if (AdvGame.GetReferences() == null)
        {
            Debug.LogError("A References file is required - please use the Adventure Creator window to create one.");
            EditorGUILayout.LabelField("No References file found!");
        }
        else
        {
            actionsManager = AdvGame.GetReferences().actionsManager;

            ActionList _target = (ActionList)target;

            if (actionsManager)
            {
                int numActions = _target.actions.Count;
                if (numActions < 1)
                {
                    numActions = 1;

                    string defaultAction = actionsManager.GetDefaultAction();

                    _target.actions.Add((Action)CreateInstance(defaultAction));
                }

                EditorGUILayout.BeginHorizontal();

                if (GUILayout.Button("Expand all"))
                {
                    Undo.RegisterUndo(_target, "Expand actions");

                    foreach (Action action in _target.actions)
                    {
                        action.isDisplayed = true;
                    }
                }

                if (GUILayout.Button("Collapse all"))
                {
                    Undo.RegisterUndo(_target, "Collapse actions");

                    foreach (Action action in _target.actions)
                    {
                        action.isDisplayed = false;
                    }
                }

                EditorGUILayout.EndHorizontal();

                for (int i = 0; i < _target.actions.Count; i++)
                {
                    EditorGUILayout.BeginVertical("Button");
                    typeNumber = GetTypeNumber(i);

                    string actionLabel = " " + (i).ToString() + ": " + _target.actions[i].title + _target.actions[i].SetLabel();

                    _target.actions[i].isDisplayed = EditorGUILayout.Foldout(_target.actions[i].isDisplayed, actionLabel);

                    if (_target.actions[i].isDisplayed)
                    {
                        typeNumber = EditorGUILayout.Popup("Action type:", typeNumber, actionsManager.GetActionTitles());
                        EditorGUILayout.Space();

                        // Rebuild constructor if Subclass and type string do not match
                        if (_target.actions[i].GetType().ToString() != actionsManager.GetActionName(typeNumber))
                        {
                            _target.actions[i] = RebuildAction(_target.actions[i], typeNumber);
                        }

                        ShowActionGUI(_target.actions[i], _target.gameObject, i, _target.actions.Count);

                        EditorGUILayout.BeginHorizontal();

                        if (i > 0)
                        {
                            if (GUILayout.Button("Move up"))
                            {
                                Undo.RegisterUndo(_target, "Move action up");
                                _target.actions = AdvGame.SwapActions(_target.actions, i, i - 1);
                            }
                        }

                        if (i < _target.actions.Count - 1)
                        {
                            if (GUILayout.Button("Insert new"))
                            {
                                Undo.RegisterUndo(_target, "Create action");

                                numActions += 1;

                                _target.actions = ResizeList(_target.actions, numActions);
                                // Swap all elements up one
                                for (int k = numActions - 1; k > i + 1; k--)
                                {
                                    _target.actions = AdvGame.SwapActions(_target.actions, k, k - 1);
                                }
                            }
                        }

                        if (_target.actions.Count > 1)
                        {
                            if (GUILayout.Button("Delete"))
                            {
                                Undo.RegisterUndo(_target, "Delete action");

                                _target.actions.RemoveAt(i);
                                numActions -= 1;
                            }
                        }

                        if (i < _target.actions.Count - 1)
                        {
                            if (GUILayout.Button("Move down"))
                            {
                                Undo.RegisterUndo(_target, "Move action down");
                                _target.actions = AdvGame.SwapActions(_target.actions, i, i + 1);
                            }
                        }

                        EditorGUILayout.EndHorizontal();
                    }

                    EditorGUILayout.EndVertical();
                    EditorGUILayout.Space();
                }

                if (GUILayout.Button("Add new action"))
                {
                    Undo.RegisterUndo(_target, "Create action");
                    numActions += 1;
                }

                _target.actions = ResizeList(_target.actions, numActions);
            }
        }
    }
示例#6
0
    override public void ShowGUI()
    {
        if (!inventoryManager)
        {
            inventoryManager = AdvGame.GetReferences().inventoryManager;
        }

        if (inventoryManager)
        {
            // Create a string List of the field's names (for the PopUp box)
            List <string> labelList = new List <string>();

            int i = 0;
            invNumber = -1;

            if (inventoryManager.items.Count > 0)
            {
                foreach (InvItem _item in inventoryManager.items)
                {
                    labelList.Add(_item.label);

                    // If a item has been removed, make sure selected variable is still valid
                    if (_item.id == invID)
                    {
                        invNumber = i;
                    }

                    i++;
                }

                if (invNumber == -1)
                {
                    Debug.Log("Previously chosen item no longer exists!");
                    invNumber = 0;
                    invID     = 0;
                }

                EditorGUILayout.BeginHorizontal();
                invAction = (InvAction)EditorGUILayout.EnumPopup("Inventory item:", invAction);

                invNumber = EditorGUILayout.Popup(invNumber, labelList.ToArray());
                invID     = inventoryManager.items[invNumber].id;
                EditorGUILayout.EndHorizontal();

                if (inventoryManager.items[invNumber].canCarryMultiple)
                {
                    setAmount = EditorGUILayout.Toggle("Set amount?", setAmount);

                    if (setAmount)
                    {
                        if (invAction == InvAction.Add)
                        {
                            amount = EditorGUILayout.IntField("Increase count by:", amount);
                        }
                        else
                        {
                            amount = EditorGUILayout.IntField("Reduce count by:", amount);
                        }
                    }
                    else
                    {
                        amount = 1;
                    }
                }
                else
                {
                    amount = 1;
                }

                AfterRunningOption();
            }

            else
            {
                EditorGUILayout.LabelField("No inventory items exist!");
                invID     = -1;
                invNumber = -1;
            }
        }
    }
示例#7
0
    private void Start()
    {
        if (AdvGame.GetReferences() && AdvGame.GetReferences().speechManager)
        {
            speechManager = AdvGame.GetReferences().speechManager;
        }

        SetFontSize();

        menus.Add(pauseMenu);
        menus.Add(optionsMenu);
        menus.Add(saveMenu);
        menus.Add(loadMenu);
        menus.Add(inventoryMenu);
        menus.Add(inGameMenu);
        menus.Add(conversationMenu);
        menus.Add(hotspotMenu);
        menus.Add(subsMenu);

        pauseMenu.Add(pause_ResumeButton);
        pauseMenu.Add(pause_OptionsButton);

        if (Application.platform != RuntimePlatform.OSXWebPlayer && Application.platform != RuntimePlatform.WindowsWebPlayer)
        {
            pauseMenu.Add(pause_SaveButton);
            pauseMenu.Add(pause_LoadButton);
        }
        pauseMenu.Add(pause_QuitButton);
        pauseMenu.SetBackground(backgroundTexture);
        pauseMenu.Centre();

        optionsMenu.Add(options_Title);
        options_Speech.SetSliderTexture(sliderTexture);
        options_Music.SetSliderTexture(sliderTexture);
        options_Sfx.SetSliderTexture(sliderTexture);
        optionsMenu.Add(options_Speech);
        optionsMenu.Add(options_Music);
        optionsMenu.Add(options_Sfx);

        if (speechManager)
        {
            options_Language = new MenuCycle("Language", speechManager.languages.ToArray());
            optionsMenu.Add(options_Language);
            if (speechManager.languages.Count == 1)
            {
                options_Language.isVisible = false;
            }
        }

        optionsMenu.Add(options_Subs);
        optionsMenu.Add(options_BackButton);
        optionsMenu.SetBackground(backgroundTexture);
        optionsMenu.Centre();

        saveMenu.Add(save_Title);
        saveMenu.Add(save_SavesList);
        saveMenu.Add(save_NewButton);
        saveMenu.Add(save_BackButton);
        saveMenu.SetBackground(backgroundTexture);
        saveMenu.Centre();

        loadMenu.Add(load_Title);
        loadMenu.Add(load_SavesList);
        loadMenu.Add(load_BackButton);
        loadMenu.SetBackground(backgroundTexture);
        loadMenu.Centre();

        inventoryMenu.Add(inventory_Box);
        inventoryMenu.SetSize(new Vector2(1f, 0.12f));
        inventoryMenu.Align(TextAnchor.UpperCenter);
        inventoryMenu.SetBackground(backgroundTexture);

        inGameMenu.Add(inGame_MenuButton);
        inGameMenu.Align(TextAnchor.LowerLeft);
        inGameMenu.SetBackground(backgroundTexture);

        conversationMenu.Add(dialog_Box);
        conversationMenu.Add(dialog_Timer);
        conversationMenu.SetCentre(new Vector2(0.25f, 0.72f));
        dialog_Timer.SetSize(new Vector2(0.2f, 0.01f));
        dialog_Timer.SetTimerTexture(sliderTexture);
        conversationMenu.SetBackground(backgroundTexture);

        subsMenu.Add(subs_Speaker);
        subsMenu.Add(subs_Line);
        subsMenu.SetBackground(backgroundTexture);
        subs_Line.SetAlignment(TextAnchor.UpperLeft);
        subsMenu.SetCentre(new Vector2(0.5f, 0.85f));

        hotspotMenu.Add(hotspot_Label);

        if (Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXWebPlayer || Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsWebPlayer)
        {
            pause_QuitButton.isVisible = false;
            pauseMenu.AutoResize();
        }

        SetStyles();

        if (GameObject.FindWithTag(Tags.persistentEngine))
        {
            if (GameObject.FindWithTag(Tags.persistentEngine).GetComponent <Options>())
            {
                options = GameObject.FindWithTag(Tags.persistentEngine).GetComponent <Options>();
            }

            if (GameObject.FindWithTag(Tags.persistentEngine).GetComponent <SaveSystem>())
            {
                saveSystem = GameObject.FindWithTag(Tags.persistentEngine).GetComponent <SaveSystem>();
            }
        }
    }
示例#8
0
    public override void CharSettingsGUI()
    {
                #if UNITY_EDITOR
        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Standard 3D animations:", EditorStyles.boldLabel);

        if (AdvGame.GetReferences() && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.IsTopDown())
        {
            character.spriteChild = (Transform)EditorGUILayout.ObjectField("Animation child:", character.spriteChild, typeof(Transform), true);
        }
        else
        {
            character.spriteChild = null;
        }

        character.talkingAnimation = (TalkingAnimation)EditorGUILayout.EnumPopup("Talk animation style:", character.talkingAnimation);
        character.idleAnim         = (AnimationClip)EditorGUILayout.ObjectField("Idle:", character.idleAnim, typeof(AnimationClip), false);
        character.walkAnim         = (AnimationClip)EditorGUILayout.ObjectField("Walk:", character.walkAnim, typeof(AnimationClip), false);
        character.runAnim          = (AnimationClip)EditorGUILayout.ObjectField("Run:", character.runAnim, typeof(AnimationClip), false);
        if (character.talkingAnimation == TalkingAnimation.Standard)
        {
            character.talkAnim = (AnimationClip)EditorGUILayout.ObjectField("Talk:", character.talkAnim, typeof(AnimationClip), false);
        }

        if (AdvGame.GetReferences() && AdvGame.GetReferences().speechManager)
        {
            if (AdvGame.GetReferences() && AdvGame.GetReferences().speechManager&&
                AdvGame.GetReferences().speechManager.lipSyncMode != LipSyncMode.Off && AdvGame.GetReferences().speechManager.lipSyncMode != LipSyncMode.FaceFX)
            {
                if (AdvGame.GetReferences().speechManager.lipSyncOutput == LipSyncOutput.PortraitAndGameObject)
                {
                    if (character.GetShapeable())
                    {
                        character.lipSyncGroupID = ActionBlendShape.ShapeableGroupGUI("Phoneme shape group:", character.GetShapeable().shapeGroups, character.lipSyncGroupID);
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("Attach a Shapeable script to show phoneme options", MessageType.Info);
                    }
                }
                else if (AdvGame.GetReferences().speechManager.lipSyncOutput == LipSyncOutput.GameObjectTexture)
                {
                    if (character.GetComponent <LipSyncTexture>() == null)
                    {
                        EditorGUILayout.HelpBox("Attach a LipSyncTexture script to allow texture lip-syncing.", MessageType.Info);
                    }
                }
            }
        }

        character.turnLeftAnim      = (AnimationClip)EditorGUILayout.ObjectField("Turn left:", character.turnLeftAnim, typeof(AnimationClip), false);
        character.turnRightAnim     = (AnimationClip)EditorGUILayout.ObjectField("Turn right:", character.turnRightAnim, typeof(AnimationClip), false);
        character.headLookLeftAnim  = (AnimationClip)EditorGUILayout.ObjectField("Head look left:", character.headLookLeftAnim, typeof(AnimationClip), false);
        character.headLookRightAnim = (AnimationClip)EditorGUILayout.ObjectField("Head look right:", character.headLookRightAnim, typeof(AnimationClip), false);
        character.headLookUpAnim    = (AnimationClip)EditorGUILayout.ObjectField("Head look up:", character.headLookUpAnim, typeof(AnimationClip), false);
        character.headLookDownAnim  = (AnimationClip)EditorGUILayout.ObjectField("Head look down:", character.headLookDownAnim, typeof(AnimationClip), false);
        if (character is Player)
        {
            Player player = (Player)character;
            player.jumpAnim = (AnimationClip)EditorGUILayout.ObjectField("Jump:", player.jumpAnim, typeof(AnimationClip), false);
        }
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical("Button");
        EditorGUILayout.LabelField("Bone transforms:", EditorStyles.boldLabel);

        character.upperBodyBone = (Transform)EditorGUILayout.ObjectField("Upper body:", character.upperBodyBone, typeof(Transform), true);
        character.neckBone      = (Transform)EditorGUILayout.ObjectField("Neck bone:", character.neckBone, typeof(Transform), true);
        character.leftArmBone   = (Transform)EditorGUILayout.ObjectField("Left arm:", character.leftArmBone, typeof(Transform), true);
        character.rightArmBone  = (Transform)EditorGUILayout.ObjectField("Right arm:", character.rightArmBone, typeof(Transform), true);
        character.leftHandBone  = (Transform)EditorGUILayout.ObjectField("Left hand:", character.leftHandBone, typeof(Transform), true);
        character.rightHandBone = (Transform)EditorGUILayout.ObjectField("Right hand:", character.rightHandBone, typeof(Transform), true);
        EditorGUILayout.EndVertical();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(character);
        }
                #endif
    }
示例#9
0
        public override void OnGUI(int WindowID)
        {
            if (inventoryManager == null && AdvGame.GetReferences().inventoryManager)
            {
                inventoryManager = AdvGame.GetReferences().inventoryManager;
            }
            if (settingsManager == null && AdvGame.GetReferences().settingsManager)
            {
                settingsManager = AdvGame.GetReferences().settingsManager;
            }

            if (inventoryManager)
            {
                // Create a string List of the field's names (for the PopUp box)
                List <string> labelList = new List <string>();

                int i = 0;
                if (parameterID == -1)
                {
                    invNumber = -1;
                }

                if (inventoryManager.items.Count > 0)
                {
                    foreach (InvItem _item in inventoryManager.items)
                    {
                        labelList.Add(_item.label);

                        // If an item has been removed, make sure selected variable is still valid
                        if (_item.id == invID)
                        {
                            invNumber = i;
                        }

                        i++;
                    }

                    if (invNumber == -1)
                    {
                        // Wasn't found (item was possibly deleted), so revert to zero
                        ACDebug.LogWarning("Previously chosen item no longer exists!");

                        invNumber = 0;
                        invID     = 0;
                    }


                    parameterID = AC.Action.ChooseParameterGUI("Inventory item:", parameters, parameterID, ParameterType.InventoryItem);
                    if (parameterID >= 0)
                    {
                        invNumber = Mathf.Min(invNumber, inventoryManager.items.Count - 1);
                        invID     = -1;
                    }
                    else
                    {
                        invNumber = EditorGUILayout.Popup("Inventory item:", invNumber, labelList.ToArray());
                        invID     = inventoryManager.items[invNumber].id;
                    }
                    //

                    if (inventoryManager.items[invNumber].canCarryMultiple)
                    {
                        doCount = EditorGUILayout.Toggle("Query count?", doCount);

                        if (doCount)
                        {
                            EditorGUILayout.BeginHorizontal();
                            EditorGUILayout.LabelField("Count is:", GUILayout.MaxWidth(70));
                            intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);
                            intValue     = EditorGUILayout.IntField(intValue);

                            if (intValue < 1)
                            {
                                intValue = 1;
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                    }
                    else
                    {
                        doCount = false;
                    }

                    if (settingsManager != null && settingsManager.playerSwitching == PlayerSwitching.Allow && !settingsManager.shareInventory)
                    {
                        EditorGUILayout.Space();

                        setPlayer = EditorGUILayout.Toggle("Check specific player?", setPlayer);
                        if (setPlayer)
                        {
                            ChoosePlayerGUI();
                        }
                    }
                    else
                    {
                        setPlayer = false;
                    }
                }
                else
                {
                    EditorGUILayout.LabelField("No inventory items exist!");
                    invID     = -1;
                    invNumber = -1;
                }
            }
            else
            {
                EditorGUILayout.HelpBox("An Inventory Manager must be assigned for this Action to work", MessageType.Warning);
            }
        }
示例#10
0
    public override void OnInspectorGUI()
    {
        _target.isTimed = EditorGUILayout.Toggle("Is timed?", _target.isTimed);

        if (_target.isTimed)
        {
            _target.timer = EditorGUILayout.FloatField("Timer length (s):", _target.timer);
        }

        foreach (ButtonDialog option in _target.options)
        {
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.BeginHorizontal();
            option.label = EditorGUILayout.TextField("Label", option.label);
            if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
            {
                Undo.RegisterSceneUndo("Delete dialogue option");
                _target.options.Remove(option);
                break;
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();

            option.dialogueOption = (DialogueOption)EditorGUILayout.ObjectField("Interaction:", option.dialogueOption, typeof(DialogueOption), true);

            if (option.dialogueOption == null)
            {
                if (GUILayout.Button("Auto-create", GUILayout.MaxWidth(90f)))
                {
                    Undo.RegisterSceneUndo("Auto-create dialogue option");
                    DialogueOption newDialogueOption = AdvGame.GetReferences().sceneManager.AddPrefab("Logic", "DialogueOption", true, false, true).GetComponent <DialogueOption>();

                    newDialogueOption.gameObject.name = AdvGame.UniqueName(_target.gameObject.name + "_Option");
                    option.dialogueOption             = newDialogueOption;
                }
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Is enabled?", GUILayout.MaxWidth(90));
            option.isOn = EditorGUILayout.Toggle(option.isOn, buttonWidth);
            if (_target.isTimed)
            {
                if (_target.defaultOption == option)
                {
                    EditorGUILayout.LabelField("Default");
                }
                else
                {
                    if (GUILayout.Button("Make default", GUILayout.MaxWidth(80)))
                    {
                        Undo.RegisterUndo(_target, "Change default conversation option");
                        _target.defaultOption = option;
                    }
                }
            }
            EditorGUILayout.EndHorizontal();

            option.returnToConversation = EditorGUILayout.Toggle("Return to conversation?", option.returnToConversation);

            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
        }

        if (GUILayout.Button("Add new dialogue option"))
        {
            Undo.RegisterSceneUndo("Create dialogue option");
            _target.options.Add(new ButtonDialog());
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(_target);
        }
    }
示例#11
0
    public static void ModifyAction(ActionListAsset _target, AC.Action _action, string callback)
    {
        ActionsManager actionsManager = AdvGame.GetReferences().actionsManager;

        if (actionsManager == null)
        {
            return;
        }

        int i = -1;

        if (_action != null && _target.actions.IndexOf(_action) > -1)
        {
            i = _target.actions.IndexOf(_action);
        }

        switch (callback)
        {
        case "Enable":
            Undo.RecordObject(_target, "Enable action");
            _target.actions [i].isEnabled = true;
            break;

        case "Disable":
            Undo.RecordObject(_target, "Disable action");
            _target.actions [i].isEnabled = false;
            break;

        case "Cut":
            Undo.RecordObject(_target, "Cut action");
            List <AC.Action> cutList   = new List <AC.Action>();
            AC.Action        cutAction = Object.Instantiate(_action) as AC.Action;
            cutList.Add(cutAction);
            AdvGame.copiedActions = cutList;
            _target.actions.Remove(_action);
            UnityEngine.Object.DestroyImmediate(_action, true);
            AssetDatabase.SaveAssets();
            break;

        case "Copy":
            List <AC.Action> copyList   = new List <AC.Action>();
            AC.Action        copyAction = Object.Instantiate(_action) as AC.Action;
            copyAction.name = copyAction.name.Replace("(Clone)", "");
            copyList.Add(copyAction);
            AdvGame.copiedActions = copyList;
            break;

        case "Paste after":
            Undo.RecordObject(_target, "Paste actions");
            List <AC.Action> pasteList = AdvGame.copiedActions;
            int j = i + 1;
            foreach (AC.Action action in pasteList)
            {
                AC.Action pastedAction = Object.Instantiate(action) as AC.Action;
                pastedAction.name      = pastedAction.name.Replace("(Clone)", "");
                pastedAction.hideFlags = HideFlags.HideInHierarchy;
                _target.actions.Insert(j, pastedAction);
                j++;
                AssetDatabase.AddObjectToAsset(pastedAction, _target);
                AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(pastedAction));
            }
            AssetDatabase.SaveAssets();
            break;

        case "Insert after":
            Undo.RecordObject(_target, "Create action");
            ActionListAssetEditor.AddAction(actionsManager.GetDefaultAction(), i + 1, _target);
            break;

        case "Delete":
            Undo.RecordObject(_target, "Delete action");
            _target.actions.Remove(_action);
            UnityEngine.Object.DestroyImmediate(_action, true);
            AssetDatabase.SaveAssets();
            break;

        case "Move to top":
            Undo.RecordObject(_target, "Move action to top");
            _target.actions.Remove(_action);
            _target.actions.Insert(0, _action);
            break;

        case "Move up":
            Undo.RecordObject(_target, "Move action up");
            _target.actions.Remove(_action);
            _target.actions.Insert(i - 1, _action);
            break;

        case "Move to bottom":
            Undo.RecordObject(_target, "Move action to bottom");
            _target.actions.Remove(_action);
            _target.actions.Insert(_target.actions.Count, _action);
            break;

        case "Move down":
            Undo.RecordObject(_target, "Move action down");
            _target.actions.Remove(_action);
            _target.actions.Insert(i + 1, _action);
            break;
        }
    }
示例#12
0
    private void Awake()
    {
        // Test for key imports
        References references = (References)Resources.Load(Resource.references);

        if (references)
        {
            SceneManager     sceneManager     = AdvGame.GetReferences().sceneManager;
            SettingsManager  settingsManager  = AdvGame.GetReferences().settingsManager;
            ActionsManager   actionsManager   = AdvGame.GetReferences().actionsManager;
            InventoryManager inventoryManager = AdvGame.GetReferences().inventoryManager;
            VariablesManager variablesManager = AdvGame.GetReferences().variablesManager;
            SpeechManager    speechManager    = AdvGame.GetReferences().speechManager;

            if (sceneManager == null)
            {
                Debug.LogError("No Scene Manager found - please set one using the Adventure Creator Kit wizard");
            }

            if (settingsManager == null)
            {
                Debug.LogError("No Settings Manager found - please set one using the Adventure Creator Kit wizard");
            }
            else
            {
                if (!GameObject.FindGameObjectWithTag(Tags.player))
                {
                    try
                    {
                        Player ref_player = AdvGame.GetReferences().settingsManager.player;
                        Player player     = (Player)Instantiate(ref_player);
                        player.name = ref_player.name;
                    }
                    catch {}
                }
            }

            if (actionsManager == null)
            {
                Debug.LogError("No Actions Manager found - please set one using the Adventure Creator Kit wizard");
            }

            if (inventoryManager == null)
            {
                Debug.LogError("No Inventory Manager found - please set one using the Adventure Creator Kit wizard");
            }

            if (variablesManager == null)
            {
                Debug.LogError("No Variables Manager found - please set one using the Adventure Creator Kit wizard");
            }

            if (speechManager == null)
            {
                Debug.LogError("No Speech Manager found - please set one using the Adventure Creator Kit wizard");
            }

            if (GameObject.FindWithTag(Tags.player) == null)
            {
                Debug.LogError("No Player found - please set one using the Settings Manager, tagging it as Player");
            }
        }
        else
        {
            Debug.LogError("No References object found. Please set one using the Adventure Creator Kit wizard.");
        }

        if (!GameObject.FindGameObjectWithTag(Tags.persistentEngine))
        {
            try
            {
                GameObject persistentEngine = (GameObject)Instantiate(Resources.Load(Resource.persistentEngine));
                persistentEngine.name = AdvGame.GetName(Resource.persistentEngine);
            }
            catch {}
        }

        if (GameObject.FindWithTag(Tags.persistentEngine) == null)
        {
            Debug.LogError("No PersistentEngine prefab found - please place one in the Resources directory, and tag it as PersistentEngine");
        }
        else
        {
            GameObject persistentEngine = GameObject.FindWithTag(Tags.persistentEngine);

            if (persistentEngine.GetComponent <Options>() == null)
            {
                Debug.LogError(persistentEngine.name + " has no Options component attached.");
            }
            if (persistentEngine.GetComponent <RuntimeInventory>() == null)
            {
                Debug.LogError(persistentEngine.name + " has no RuntimeInventory component attached.");
            }
            if (persistentEngine.GetComponent <RuntimeVariables>() == null)
            {
                Debug.LogError(persistentEngine.name + " has no RuntimeVariables component attached.");
            }
            if (persistentEngine.GetComponent <StateHandler>() == null)
            {
                Debug.LogError(persistentEngine.name + " has no StateHandler component attached.");
            }
            if (persistentEngine.GetComponent <SceneChanger>() == null)
            {
                Debug.LogError(persistentEngine.name + " has no SceneChanger component attached.");
            }
            if (persistentEngine.GetComponent <SaveSystem>() == null)
            {
                Debug.LogError(persistentEngine.name + " has no SaveSystem component attached.");
            }
            if (persistentEngine.GetComponent <LevelStorage>() == null)
            {
                Debug.LogError(persistentEngine.name + " has no LevelStorage component attached.");
            }
        }

        if (GameObject.FindWithTag(Tags.mainCamera) == null)
        {
            Debug.LogError("No MainCamera found - please click 'Organise room objects' in the Scene Manager to create one.");
        }
        else
        {
            if (GameObject.FindWithTag(Tags.mainCamera).GetComponent <MainCamera>() == null)
            {
                Debug.LogError("MainCamera has no MainCamera component.");
            }
        }

        if (this.tag == Tags.gameEngine)
        {
            if (this.GetComponent <MenuSystem>() == null)
            {
                Debug.LogError(this.name + " has no MenuSystem component attached.");
            }

            if (this.GetComponent <Dialog>() == null)
            {
                Debug.LogError(this.name + " has no Dialog component attached.");
            }

            if (this.GetComponent <PlayerInput>() == null)
            {
                Debug.LogError(this.name + " has no PlayerInput component attached.");
            }

            if (this.GetComponent <PlayerInteraction>() == null)
            {
                Debug.LogError(this.name + " has no PlayerInteraction component attached.");
            }

            if (this.GetComponent <PlayerMenus>() == null)
            {
                Debug.LogError(this.name + " has no PlayerMenus component attached.");
            }

            if (this.GetComponent <PlayerMovement>() == null)
            {
                Debug.LogError(this.name + " has no PlayerMovement component attached.");
            }
            if
            (this.GetComponent <PlayerCursor>() == null)
            {
                Debug.LogError(this.name + " has no PlayerCursor component attached.");
            }

            if (this.GetComponent <SceneSettings>() == null)
            {
                Debug.LogError(this.name + " has no SceneSettings component attached.");
            }
            else
            {
                if (this.GetComponent <SceneSettings>().navMesh == null)
                {
                    Debug.LogWarning("No NavMesh set.  Characters will not be able to PathFind until one is defined - please choose one using the Scene Manager.");
                }

                if (this.GetComponent <SceneSettings>().defaultPlayerStart == null)
                {
                    Debug.LogWarning("No default PlayerStart set.  The game may not be able to begin if one is not defined - please choose one using the Scene Manager.");
                }
            }

            if (this.GetComponent <RuntimeActionList>() == null)
            {
                Debug.LogError(this.name + " has no RuntimeActionList component attached.");
            }
        }
    }
示例#13
0
    public void ShowGUI(int lowerValue, int upperValue)
    {
        if (!variablesManager)
        {
            variablesManager = AdvGame.GetReferences().variablesManager;
        }

        if (variablesManager)
        {
            // Create a string List of the field's names (for the PopUp box)
            List <string> labelList = new List <string>();

            int i = 0;
            variableNumber = -1;

            if (variablesManager.vars.Count > 0)
            {
                foreach (GVar _var in variablesManager.vars)
                {
                    labelList.Add(_var.label);

                    // If a GlobalVar variable has been removed, make sure selected variable is still valid
                    if (_var.id == variableID)
                    {
                        variableNumber = i;
                    }

                    i++;
                }

                if (variableNumber == -1)
                {
                    // Wasn't found (variable was deleted?), so revert to zero
                    Debug.LogWarning("Previously chosen variable no longer exists!");
                    variableNumber = 0;
                    variableID     = 0;
                }

                EditorGUILayout.BeginHorizontal();

                variableNumber = EditorGUILayout.Popup(variableNumber, labelList.ToArray());
                variableID     = variablesManager.vars[variableNumber].id;

                if (variablesManager.vars[variableNumber].type == VariableType.Boolean)
                {
                    boolCondition = (BoolCondition)EditorGUILayout.EnumPopup(boolCondition);
                    boolValue     = (BoolValue)EditorGUILayout.EnumPopup(boolValue);
                }
                else
                {
                    intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);
                    intValue     = EditorGUILayout.IntField(intValue);
                }

                EditorGUILayout.EndHorizontal();

                if (lowerValue > upperValue || lowerValue == upperValue)
                {
                    lowerValue = upperValue;
                }

                resultActionTrue = (Action.ResultAction)EditorGUILayout.EnumPopup("If condition is met:", (Action.ResultAction)resultActionTrue);
                if (resultActionTrue == Action.ResultAction.RunCutscene)
                {
                    linkedCutsceneTrue = (Cutscene)EditorGUILayout.ObjectField("Cutscene to run:", linkedCutsceneTrue, typeof(Cutscene), true);
                }
                else if (resultActionTrue == Action.ResultAction.Skip)
                {
                    skipActionTrue = EditorGUILayout.IntSlider("Action # to skip to:", skipActionTrue, lowerValue, upperValue);
                }

                resultActionFail = (Action.ResultAction)EditorGUILayout.EnumPopup("If condition is not met:", (Action.ResultAction)resultActionFail);
                if (resultActionFail == Action.ResultAction.RunCutscene)
                {
                    linkedCutsceneFail = (Cutscene)EditorGUILayout.ObjectField("Cutscene to run:", linkedCutsceneFail, typeof(Cutscene), true);
                }
                else if (resultActionFail == Action.ResultAction.Skip)
                {
                    skipActionFail = EditorGUILayout.IntSlider("Action # to skip to:", skipActionFail, lowerValue, upperValue);
                }
            }
            else
            {
                EditorGUILayout.LabelField("No global variables exist!");
                variableID     = -1;
                variableNumber = -1;
            }
        }
    }
示例#14
0
    public void ShowGUI(int lowerValue, int upperValue)
    {
        if (!inventoryManager)
        {
            inventoryManager = AdvGame.GetReferences().inventoryManager;
        }

        if (inventoryManager)
        {
            // Create a string List of the field's names (for the PopUp box)
            List <string> labelList = new List <string>();

            int i = 0;
            invNumber = -1;

            if (inventoryManager.items.Count > 0)
            {
                foreach (InvItem _item in inventoryManager.items)
                {
                    labelList.Add(_item.label);

                    // If an item has been removed, make sure selected variable is still valid
                    if (_item.id == invID)
                    {
                        invNumber = i;
                    }

                    i++;
                }

                if (invNumber == -1)
                {
                    // Wasn't found (item was possibly deleted), so revert to zero
                    Debug.LogWarning("Previously chosen item no longer exists!");

                    invNumber = 0;
                    invID     = 0;
                }

                EditorGUILayout.BeginHorizontal();
                invNumber = EditorGUILayout.Popup("Inventory item:", invNumber, labelList.ToArray());
                invID     = inventoryManager.items[invNumber].id;
                EditorGUILayout.EndHorizontal();

                if (lowerValue > upperValue)
                {
                    lowerValue = upperValue;
                }
                else if (upperValue < lowerValue)
                {
                    upperValue = lowerValue;
                }

                if (inventoryManager.items[invNumber].canCarryMultiple)
                {
                    doCount = EditorGUILayout.Toggle("Query count?", doCount);

                    if (doCount)
                    {
                        EditorGUILayout.BeginHorizontal("");
                        EditorGUILayout.LabelField("Count is:", GUILayout.MaxWidth(70));
                        intCondition = (IntCondition)EditorGUILayout.EnumPopup(intCondition);
                        intValue     = EditorGUILayout.IntField(intValue);

                        if (intValue < 1)
                        {
                            intValue = 1;
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                }
                else
                {
                    doCount = false;
                }

                if (doCount)
                {
                    resultActionTrue = (Action.ResultAction)EditorGUILayout.EnumPopup("If condition is met:", (Action.ResultAction)resultActionTrue);
                }
                else
                {
                    resultActionTrue = (Action.ResultAction)EditorGUILayout.EnumPopup("If player is carrying:", (Action.ResultAction)resultActionTrue);
                }

                if (resultActionTrue == Action.ResultAction.RunCutscene)
                {
                    linkedCutsceneTrue = (Cutscene)EditorGUILayout.ObjectField("Cutscene to trigger:", linkedCutsceneTrue, typeof(Cutscene), true);
                }
                else if (resultActionTrue == Action.ResultAction.Skip)
                {
                    skipActionTrue = EditorGUILayout.IntSlider("Action # to skip to:", skipActionTrue, lowerValue, upperValue);
                }

                if (doCount)
                {
                    resultActionFail = (Action.ResultAction)EditorGUILayout.EnumPopup("If condition is not met:", (Action.ResultAction)resultActionFail);
                }
                else
                {
                    resultActionFail = (Action.ResultAction)EditorGUILayout.EnumPopup("If player is not carrying:", (Action.ResultAction)resultActionFail);
                }

                if (resultActionFail == Action.ResultAction.RunCutscene)
                {
                    linkedCutsceneFail = (Cutscene)EditorGUILayout.ObjectField("Cutscene to trigger:", linkedCutsceneFail, typeof(Cutscene), true);
                }
                else if (resultActionFail == Action.ResultAction.Skip)
                {
                    skipActionFail = EditorGUILayout.IntSlider("Action # to skip to:", skipActionFail, lowerValue, upperValue);
                }
            }

            else
            {
                EditorGUILayout.LabelField("No inventory items exist!");
                invID     = -1;
                invNumber = -1;
            }
        }
    }
示例#15
0
    public override void OnInspectorGUI()
    {
        if (AdvGame.GetReferences() == null)
        {
            Debug.LogError("A References file is required - please use the Adventure Creator window to create one.");
            EditorGUILayout.LabelField("No References file found!");
        }
        else
        {
            if (!inventoryManager)
            {
                inventoryManager = AdvGame.GetReferences().inventoryManager;
            }

            _target.hotspotName  = EditorGUILayout.TextField("Label (if not object name):", _target.hotspotName);
            _target.highlight    = (Highlight)EditorGUILayout.ObjectField("Object to highlight:", _target.highlight, typeof(Highlight), true);
            _target.walkToMarker = (Marker)EditorGUILayout.ObjectField("Walk-to marker:", _target.walkToMarker, typeof(Marker), true);

            // Use
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Use interaction", EditorStyles.boldLabel);

            if (!_target.provideUseInteraction)
            {
                if (GUILayout.Button(addContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RegisterSceneUndo("Create use interaction");
                    _target.provideUseInteraction = true;
                }
            }
            else
            {
                if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RegisterSceneUndo("Delete use interaction");
                    _target.provideUseInteraction = false;
                }
            }

            EditorGUILayout.EndHorizontal();
            if (_target.provideUseInteraction)
            {
                EditorGUILayout.BeginHorizontal();
                _target.useButton.interaction = (Interaction)EditorGUILayout.ObjectField("Interaction:", _target.useButton.interaction, typeof(Interaction), true);

                if (_target.useButton.interaction == null)
                {
                    if (GUILayout.Button("Auto-create", autoWidth))
                    {
                        Undo.RegisterSceneUndo("Auto-create interaction");
                        Interaction newInteraction = AdvGame.GetReferences().sceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();

                        newInteraction.gameObject.name = AdvGame.UniqueName(_target.gameObject.name + "_Use");
                        _target.useButton.interaction  = newInteraction;
                    }
                }
                EditorGUILayout.EndHorizontal();

                _target.useIcon = (InteractionIcon)EditorGUILayout.EnumPopup("Icon:", _target.useIcon);
                _target.useButton.playerAction = (PlayerAction)EditorGUILayout.EnumPopup("Player action:", _target.useButton.playerAction);

                if (_target.useButton.playerAction == PlayerAction.WalkTo)
                {
                    EditorGUILayout.BeginVertical("Button");
                    _target.useButton.setProximity = EditorGUILayout.BeginToggleGroup("Set minimum distance?", _target.useButton.setProximity);
                    _target.useButton.proximity    = EditorGUILayout.FloatField("Proximity:", _target.useButton.proximity);
                    EditorGUILayout.EndToggleGroup();
                    EditorGUILayout.EndVertical();
                }
            }
            EditorGUILayout.EndVertical();


            // Look
            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Examine interaction", EditorStyles.boldLabel);

            if (!_target.provideLookInteraction)
            {
                if (GUILayout.Button(addContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RegisterSceneUndo("Create examine interaction");
                    _target.provideLookInteraction = true;
                }
            }
            else
            {
                if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RegisterSceneUndo("Delete examine interaction");
                    _target.provideLookInteraction = false;
                }
            }

            EditorGUILayout.EndHorizontal();
            if (_target.provideLookInteraction)
            {
                EditorGUILayout.BeginHorizontal();

                _target.lookButton.interaction = (Interaction)EditorGUILayout.ObjectField("Interaction:", _target.lookButton.interaction, typeof(Interaction), true);

                if (_target.lookButton.interaction == null)
                {
                    if (GUILayout.Button("Auto-create", autoWidth))
                    {
                        Undo.RegisterSceneUndo("Auto-create interaction");
                        Interaction newInteraction = AdvGame.GetReferences().sceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();

                        newInteraction.gameObject.name = AdvGame.UniqueName(_target.gameObject.name + "_Look");
                        _target.lookButton.interaction = newInteraction;
                    }
                }

                EditorGUILayout.EndHorizontal();

                _target.lookButton.playerAction = (PlayerAction)EditorGUILayout.EnumPopup("Player action:", _target.lookButton.playerAction);

                if (_target.lookButton.playerAction == PlayerAction.WalkTo)
                {
                    EditorGUILayout.BeginVertical("Button");
                    _target.lookButton.setProximity = EditorGUILayout.BeginToggleGroup("Set minimum distance?", _target.lookButton.setProximity);
                    _target.lookButton.proximity    = EditorGUILayout.FloatField("Proximity:", _target.lookButton.proximity);
                    EditorGUILayout.EndToggleGroup();
                    EditorGUILayout.EndVertical();
                }
            }
            EditorGUILayout.EndVertical();

            // Inventory
            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical("Button");
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Inventory interactions", EditorStyles.boldLabel);

            if (GUILayout.Button(addContent, EditorStyles.miniButtonRight, buttonWidth))
            {
                Undo.RegisterSceneUndo("Create inventory interaction");
                _target.invButtons.Add(new Button());
                _target.provideInvInteraction = true;
            }
            EditorGUILayout.EndHorizontal();

            if (_target.provideInvInteraction)
            {
                if (inventoryManager)
                {
                    // Create a string List of the field's names (for the PopUp box)
                    List <string> labelList = new List <string>();
                    int           invNumber;

                    if (inventoryManager.items.Count > 0)
                    {
                        foreach (InvItem _item in inventoryManager.items)
                        {
                            labelList.Add(_item.label);
                        }

                        foreach (Button invButton in _target.invButtons)
                        {
                            invNumber = -1;

                            int j = 0;
                            foreach (InvItem _item in inventoryManager.items)
                            {
                                // If an item has been removed, make sure selected variable is still valid
                                if (_item.id == invButton.invID)
                                {
                                    invNumber = j;
                                    break;
                                }

                                j++;
                            }

                            if (invNumber == -1)
                            {
                                // Wasn't found (item was deleted?), so revert to zero
                                Debug.Log("Previously chosen item no longer exists!");
                                invNumber       = 0;
                                invButton.invID = 0;
                            }

                            EditorGUILayout.Space();
                            EditorGUILayout.BeginHorizontal();

                            invNumber = EditorGUILayout.Popup("Inventory item:", invNumber, labelList.ToArray());

                            // Re-assign variableID based on PopUp selection
                            invButton.invID = inventoryManager.items[invNumber].id;

                            if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                            {
                                Undo.RegisterSceneUndo("Delete inventory interaction");

                                _target.invButtons.Remove(invButton);

                                if (_target.invButtons.Count == 0)
                                {
                                    _target.provideInvInteraction = false;
                                }

                                break;
                            }

                            EditorGUILayout.EndHorizontal();
                            EditorGUILayout.BeginHorizontal();

                            invButton.interaction = (Interaction)EditorGUILayout.ObjectField("Interaction:", invButton.interaction, typeof(Interaction), true);

                            if (invButton.interaction == null)
                            {
                                if (GUILayout.Button("Auto-create", autoWidth))
                                {
                                    Undo.RegisterSceneUndo("Create Interaction");
                                    Interaction newInteraction = AdvGame.GetReferences().sceneManager.AddPrefab("Logic", "Interaction", true, false, true).GetComponent <Interaction>();

                                    newInteraction.gameObject.name = AdvGame.UniqueName(_target.gameObject.name + "_Inv");
                                    invButton.interaction          = newInteraction;
                                }
                            }

                            EditorGUILayout.EndHorizontal();

                            invButton.playerAction = (PlayerAction)EditorGUILayout.EnumPopup("Player action:", invButton.playerAction);

                            if (invButton.playerAction == PlayerAction.WalkTo)
                            {
                                EditorGUILayout.BeginVertical("Button");
                                invButton.setProximity = EditorGUILayout.BeginToggleGroup("Set minimum distance?", invButton.setProximity);
                                invButton.proximity    = EditorGUILayout.FloatField("Proximity:", invButton.proximity);
                                EditorGUILayout.EndToggleGroup();
                                EditorGUILayout.EndVertical();
                            }
                        }
                    }
                    else
                    {
                        EditorGUILayout.LabelField("No inventory items exist!");
                        invNumber = -1;

                        for (int i = 0; i < _target.invButtons.Count; i++)
                        {
                            _target.invButtons[i].invID = -1;
                        }
                    }
                }
                else
                {
                    Debug.LogWarning("An InventoryManager is required to run the game properly - please open the GameManager wizard and set one.");
                }
            }

            EditorGUILayout.EndVertical();
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(_target);
        }
    }