示例#1
0
 protected void GetReferences()
 {
     if (AdvGame.GetReferences ().cursorManager)
     {
         cursorManager = AdvGame.GetReferences ().cursorManager;
     }
 }
示例#2
0
 protected void ChangeCursorGUI(MenuSource source)
 {
     changeCursor = EditorGUILayout.Toggle("Change cursor when over?", changeCursor);
     if (changeCursor)
     {
         CursorManager cursorManager = AdvGame.GetReferences().cursorManager;
         if (cursorManager != null)
         {
             int cursorIndex = cursorManager.GetIntFromID(cursorID);
             cursorIndex = EditorGUILayout.Popup("Cursor ID:", cursorIndex, cursorManager.GetLabelsArray());
             cursorID    = cursorManager.cursorIcons[cursorIndex].id;
         }
         else
         {
             EditorGUILayout.HelpBox("No Cursor Manager found!", MessageType.Warning);
         }
     }
 }
示例#3
0
        /**
         * <summary>Unsets the values of all script variables, so that they can be re-assigned to the correct scene if multiple scenes are open.</summary>
         */
        public void ClearVariables()
        {
            playerPrefab           = null;
            mainCameraPrefab       = null;
            persistentEnginePrefab = null;
            gameEnginePrefab       = null;

            // Managers
            sceneManagerPrefab     = null;
            settingsManagerPrefab  = null;
            actionsManagerPrefab   = null;
            variablesManagerPrefab = null;
            inventoryManagerPrefab = null;
            speechManagerPrefab    = null;
            cursorManagerPrefab    = null;
            menuManagerPrefab      = null;

            // PersistentEngine components
            optionsComponent          = null;
            runtimeInventoryComponent = null;
            runtimeVariablesComponent = null;
            playerMenusComponent      = null;
            stateHandlerComponent     = null;
            sceneChangerComponent     = null;
            saveSystemComponent       = null;
            levelStorageComponent     = null;
            runtimeLanguagesComponent = null;

            // GameEngine components
            menuSystemComponent        = null;
            dialogComponent            = null;
            playerInputComponent       = null;
            playerInteractionComponent = null;
            playerMovementComponent    = null;
            playerCursorComponent      = null;
            playerQTEComponent         = null;
            sceneSettingsComponent     = null;
            navigationManagerComponent = null;
            actionListManagerComponent = null;
            localVariablesComponent    = null;
            menuPreviewComponent       = null;

            SetGameEngine();
        }
示例#4
0
        protected void ChangeCursorGUI(Menu menu)
        {
            string apiPrefix = "AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\")";

            changeCursor = CustomGUILayout.Toggle("Change cursor when over?", changeCursor, apiPrefix + ".changeCursor", "If True, then the mouse cursor will change when it hovers over the element");
            if (changeCursor)
            {
                CursorManager cursorManager = AdvGame.GetReferences().cursorManager;
                if (cursorManager != null)
                {
                    int cursorIndex = cursorManager.GetIntFromID(cursorID);
                    cursorIndex = CustomGUILayout.Popup("Cursor ID:", cursorIndex, cursorManager.GetLabelsArray(), apiPrefix + ".cursorID", "The Cursor to display when the mouse hovers of the element");
                    cursorID    = cursorManager.cursorIcons[cursorIndex].id;
                }
                else
                {
                    EditorGUILayout.HelpBox("No Cursor Manager found!", MessageType.Warning);
                }
            }
        }
		private void Awake ()
		{
			playerInput = this.GetComponent <PlayerInput>();
			playerCursor = this.GetComponent <PlayerCursor>();

			if (AdvGame.GetReferences () == null)
			{
				Debug.LogError ("A References file is required - please use the Adventure Creator window to create one.");
			}
			else
			{
				if (AdvGame.GetReferences ().settingsManager)
				{
					settingsManager = AdvGame.GetReferences ().settingsManager;
				}
				if (AdvGame.GetReferences ().cursorManager)
				{
					cursorManager = AdvGame.GetReferences ().cursorManager;
				}
			}
		}
示例#6
0
		private void Awake ()
		{
			if (AdvGame.GetReferences () && AdvGame.GetReferences ().settingsManager && AdvGame.GetReferences ().cursorManager)
			{
				settingsManager = AdvGame.GetReferences ().settingsManager;
				cursorManager = AdvGame.GetReferences ().cursorManager;
				
			}
			
			if (settingsManager && settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive)
			{
				UpgradeSelf ();
			}
			
			if (GetComponent <Collider>())
			{
				_collider = GetComponent <Collider>();
			}
			else if (GetComponent <Collider2D>())
			{
				_collider2D = GetComponent <Collider2D>();
			}
		}
        public override void OnInspectorGUI()
        {
            if (AdvGame.GetReferences() == null)
            {
                ACDebug.LogError("A References file is required - please use the Adventure Creator window to create one.");
                EditorGUILayout.LabelField("No References file found!");
            }
            else
            {
                if (AdvGame.GetReferences().inventoryManager)
                {
                    inventoryManager = AdvGame.GetReferences().inventoryManager;
                }
                if (AdvGame.GetReferences().cursorManager)
                {
                    cursorManager = AdvGame.GetReferences().cursorManager;
                }
                if (AdvGame.GetReferences().settingsManager)
                {
                    settingsManager = AdvGame.GetReferences().settingsManager;
                }

                if (Application.isPlaying)
                {
                    if (_target.gameObject.layer != LayerMask.NameToLayer(settingsManager.hotspotLayer))
                    {
                        EditorGUILayout.HelpBox("Current state: OFF", MessageType.Info);
                    }
                }

                if (_target.lineID > -1)
                {
                    EditorGUILayout.LabelField("Speech Manager ID:", _target.lineID.ToString());
                }

                _target.interactionSource = (AC.InteractionSource)EditorGUILayout.EnumPopup("Interaction source:", _target.interactionSource);
                _target.hotspotName       = EditorGUILayout.TextField("Label (if not name):", _target.hotspotName);
                _target.highlight         = (Highlight)EditorGUILayout.ObjectField("Object to highlight:", _target.highlight, typeof(Highlight), true);
                if (AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.hotspotDrawing == ScreenWorld.WorldSpace)
                {
                    _target.iconSortingLayer = EditorGUILayout.TextField("Icon sorting layer:", _target.iconSortingLayer);
                    _target.iconSortingOrder = EditorGUILayout.IntField("Icon sprite order:", _target.iconSortingOrder);
                }

                EditorGUILayout.BeginHorizontal();
                _target.centrePoint = (Transform)EditorGUILayout.ObjectField("Centre point (override):", _target.centrePoint, typeof(Transform), true);

                if (_target.centrePoint == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        string     prefabName = "Hotspot centre: " + _target.gameObject.name;
                        GameObject go         = SceneManager.AddPrefab("Navigation", "HotspotCentre", true, false, false);
                        go.name = prefabName;
                        go.transform.position = _target.transform.position;
                        _target.centrePoint   = go.transform;
                        if (GameObject.Find("_Markers"))
                        {
                            go.transform.parent = GameObject.Find("_Markers").transform;
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                _target.walkToMarker = (Marker)EditorGUILayout.ObjectField("Walk-to Marker:", _target.walkToMarker, typeof(Marker), true);
                if (_target.walkToMarker == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        string prefabName = "Marker";
                        if (SceneSettings.IsUnity2D())
                        {
                            prefabName += "2D";
                        }
                        Marker newMarker = SceneManager.AddPrefab("Navigation", prefabName, true, false, true).GetComponent <Marker>();
                        newMarker.gameObject.name   += (": " + _target.gameObject.name);
                        newMarker.transform.position = _target.transform.position;
                        _target.walkToMarker         = newMarker;
                    }
                }
                EditorGUILayout.EndHorizontal();

                _target.limitToCamera = (_Camera)EditorGUILayout.ObjectField("Limit to camera:", _target.limitToCamera, typeof(_Camera), true);

                EditorGUILayout.BeginHorizontal();
                _target.interactiveBoundary = (InteractiveBoundary)EditorGUILayout.ObjectField("Interactive boundary:", _target.interactiveBoundary, typeof(InteractiveBoundary), true);
                if (_target.interactiveBoundary == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        string prefabName = "InteractiveBoundary";
                        if (SceneSettings.IsUnity2D())
                        {
                            prefabName += "2D";
                        }
                        InteractiveBoundary newInteractiveBoundary = SceneManager.AddPrefab("Logic", prefabName, true, false, true).GetComponent <InteractiveBoundary>();
                        newInteractiveBoundary.gameObject.name   += (": " + _target.gameObject.name);
                        newInteractiveBoundary.transform.position = _target.transform.position;
                        _target.interactiveBoundary = newInteractiveBoundary;

                        UnityVersionHandler.PutInFolder(newInteractiveBoundary.gameObject, "_Hotspots");
                    }
                }
                EditorGUILayout.EndHorizontal();

                _target.drawGizmos = EditorGUILayout.Toggle("Draw yellow cube?", _target.drawGizmos);

                if (settingsManager != null && (settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction || settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot))
                {
                    _target.oneClick = EditorGUILayout.Toggle("Single 'Use' Interaction?", _target.oneClick);
                }
                if (_target.oneClick || (settingsManager != null && settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive))
                {
                    _target.doubleClickingHotspot = (DoubleClickingHotspot)EditorGUILayout.EnumPopup("Double-clicking:", _target.doubleClickingHotspot);
                }
                if (settingsManager != null && settingsManager.playerFacesHotspots)
                {
                    _target.playerTurnsHead = EditorGUILayout.Toggle("Turn head active?", _target.playerTurnsHead);
                }

                EditorGUILayout.Space();

                UseInteractionGUI();

                if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive || settingsManager.interactionMethod == AC_InteractionMethod.CustomScript)
                {
                    EditorGUILayout.Space();
                    LookInteractionGUI();
                }

                EditorGUILayout.Space();
                InvInteractionGUI();

                EditorGUILayout.Space();
                UnhandledInvInteractionGUI();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
示例#8
0
        private void ItemsGUI()
        {
            EditorGUILayout.BeginVertical(CustomStyles.thinBox);
            EditorGUILayout.LabelField("Unhandled events", CustomStyles.subHeader);
            EditorGUILayout.Space();

            unhandledCombine = ActionListAssetMenu.AssetGUI("Combine:", unhandledCombine, "AC.KickStarter.runtimeInventory.unhandledCombine");
            unhandledHotspot = ActionListAssetMenu.AssetGUI("Use on hotspot:", unhandledHotspot, "AC.KickStarter.runtimeInventory.unhandledHotspot");
            if (settingsManager != null && settingsManager.CanGiveItems())
            {
                unhandledGive = ActionListAssetMenu.AssetGUI("Give to NPC:", unhandledGive, "AC.KickStarter.runtimeInventory.unhandledGive");
            }

            passUnhandledHotspotAsParameter = CustomGUILayout.ToggleLeft("Pass Hotspot as GameObject parameter?", passUnhandledHotspotAsParameter, "AC.KickStarter.inventoryManager.passUnhandledHotspotAsParameter");
            if (passUnhandledHotspotAsParameter && unhandledHotspot != null)
            {
                EditorGUILayout.HelpBox("The Hotspot will be set as " + unhandledHotspot.name + "'s first parameter, which must be set to type 'GameObject'.", MessageType.Info);
            }

            List <string> binList = new List <string>();

            foreach (InvBin bin in bins)
            {
                binList.Add(bin.label);
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();
            CreateItemsGUI(binList.ToArray());
            EditorGUILayout.Space();

            if (selectedItem != null && items.Contains(selectedItem))
            {
                string apiPrefix = "AC.KickStarter.runtimeInventory.GetItem (" + selectedItem.id + ")";

                EditorGUILayout.BeginVertical(CustomStyles.thinBox);
                EditorGUILayout.LabelField("Inventory item '" + selectedItem.label + "' settings", CustomStyles.subHeader);
                EditorGUILayout.Space();

                selectedItem.label    = CustomGUILayout.TextField("Name:", selectedItem.label, apiPrefix + ".label");
                selectedItem.altLabel = CustomGUILayout.TextField("Label (if not name):", selectedItem.altLabel, apiPrefix + ".altLabel");

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Category:", GUILayout.Width(146f));
                if (bins.Count > 0)
                {
                    binNumber          = GetBinSlot(selectedItem.binID);
                    binNumber          = CustomGUILayout.Popup(binNumber, binList.ToArray(), apiPrefix + ".binID");
                    selectedItem.binID = bins[binNumber].id;
                }
                else
                {
                    selectedItem.binID = -1;
                    EditorGUILayout.LabelField("No categories defined!", EditorStyles.miniLabel, GUILayout.Width(146f));
                }
                EditorGUILayout.EndHorizontal();

                selectedItem.carryOnStart = CustomGUILayout.Toggle("Carry on start?", selectedItem.carryOnStart, apiPrefix + ".carryOnStart");
                if (selectedItem.carryOnStart && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.playerSwitching == PlayerSwitching.Allow && !AdvGame.GetReferences().settingsManager.shareInventory)
                {
                    selectedItem.carryOnStartNotDefault = CustomGUILayout.Toggle("Give to non-default player?", selectedItem.carryOnStartNotDefault, apiPrefix + ".carryOnStartNotDefault");
                    if (selectedItem.carryOnStartNotDefault)
                    {
                        selectedItem.carryOnStartID = ChoosePlayerGUI(selectedItem.carryOnStartID, apiPrefix + ".carryOnStartID");
                    }
                }

                selectedItem.canCarryMultiple = CustomGUILayout.Toggle("Can carry multiple?", selectedItem.canCarryMultiple, apiPrefix + ".canCarryMultiple");
                if (selectedItem.canCarryMultiple)
                {
                    selectedItem.useSeparateSlots = CustomGUILayout.Toggle("Place in separate slots?", selectedItem.useSeparateSlots, apiPrefix + ".useSeparateSlots");
                }
                if (selectedItem.carryOnStart && selectedItem.canCarryMultiple)
                {
                    selectedItem.count = CustomGUILayout.IntField("Quantity on start:", selectedItem.count, apiPrefix + ".count");
                }
                else
                {
                    selectedItem.count = 1;
                }

                selectedItem.overrideUseSyntax = CustomGUILayout.Toggle("Override 'Use' syntax?", selectedItem.overrideUseSyntax, apiPrefix + ".overrideUseSyntax");
                if (selectedItem.overrideUseSyntax)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Use syntax:", GUILayout.Width(100f));
                    selectedItem.hotspotPrefix1.label = EditorGUILayout.TextField(selectedItem.hotspotPrefix1.label, GUILayout.MaxWidth(80f));
                    EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f));
                    selectedItem.hotspotPrefix2.label = EditorGUILayout.TextField(selectedItem.hotspotPrefix2.label, GUILayout.MaxWidth(80f));
                    EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f));
                    EditorGUILayout.EndHorizontal();
                }

                selectedItem.linkedPrefab = (GameObject)CustomGUILayout.ObjectField <GameObject> ("Linked prefab:", selectedItem.linkedPrefab, false, apiPrefix + ".linkedPrefab");
                if (selectedItem.linkedPrefab != null)
                {
                    EditorGUILayout.HelpBox("This reference is only accessibly through scripting.", MessageType.Info);
                }

                GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Main graphic:", GUILayout.Width(145));
                selectedItem.tex = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (selectedItem.tex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".tex");
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Active graphic:", GUILayout.Width(145));
                selectedItem.activeTex = (Texture2D)CustomGUILayout.ObjectField <Texture2D> (selectedItem.activeTex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".activeTex");
                EditorGUILayout.EndHorizontal();


                if (AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.selectInventoryDisplay == SelectInventoryDisplay.ShowSelectedGraphic)
                {
                    selectedItem.selectedTex = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Selected graphic:", selectedItem.selectedTex, false, apiPrefix + ".selectedTex");
                }
                if (AdvGame.GetReferences().cursorManager != null)
                {
                    CursorManager cursorManager = AdvGame.GetReferences().cursorManager;
                    if (cursorManager.inventoryHandling == InventoryHandling.ChangeCursor || cursorManager.inventoryHandling == InventoryHandling.ChangeCursorAndHotspotLabel)
                    {
                        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                        selectedItem.cursorIcon.ShowGUI(true, "Cursor (optional):", cursorManager.cursorRendering, apiPrefix + ".cursorIcon");
                        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                    }
                }

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Standard interactions", CustomStyles.subHeader);
                if (settingsManager && settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && settingsManager.inventoryInteractions == InventoryInteractions.Multiple && AdvGame.GetReferences().cursorManager)
                {
                    CursorManager cursorManager = AdvGame.GetReferences().cursorManager;

                    List <string> iconList = new List <string>();
                    foreach (CursorIcon icon in cursorManager.cursorIcons)
                    {
                        iconList.Add(icon.label);
                    }

                    if (cursorManager.cursorIcons.Count > 0)
                    {
                        foreach (InvInteraction interaction in selectedItem.interactions)
                        {
                            EditorGUILayout.BeginHorizontal();
                            invNumber        = GetIconSlot(interaction.icon.id);
                            invNumber        = EditorGUILayout.Popup(invNumber, iconList.ToArray());
                            interaction.icon = cursorManager.cursorIcons[invNumber];

                            int    i        = selectedItem.interactions.IndexOf(interaction);
                            string autoName = selectedItem.label + "_" + interaction.icon.label;
                            interaction.actionList = ActionListAssetMenu.AssetGUI("", interaction.actionList, apiPrefix + ".interactions[" + i + "].actionList", autoName);

                            if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                            {
                                Undo.RecordObject(this, "Delete interaction");
                                selectedItem.interactions.Remove(interaction);
                                break;
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("No interaction icons defined - please use the Cursor Manager", MessageType.Warning);
                    }
                    if (GUILayout.Button("Add interaction"))
                    {
                        Undo.RecordObject(this, "Add new interaction");
                        selectedItem.interactions.Add(new InvInteraction(cursorManager.cursorIcons[0]));
                    }
                }
                else
                {
                    string autoName = selectedItem.label + "_Use";
                    selectedItem.useActionList = ActionListAssetMenu.AssetGUI("Use:", selectedItem.useActionList, apiPrefix + ".useActionList", autoName);
                    if (cursorManager && cursorManager.allowInteractionCursorForInventory && cursorManager.cursorIcons.Count > 0)
                    {
                        int useCursor_int = cursorManager.GetIntFromID(selectedItem.useIconID) + 1;
                        if (selectedItem.useIconID == -1)
                        {
                            useCursor_int = 0;
                        }
                        useCursor_int = CustomGUILayout.Popup("Use cursor icon:", useCursor_int, cursorManager.GetLabelsArray(true), apiPrefix + ".useIconID");

                        if (useCursor_int == 0)
                        {
                            selectedItem.useIconID = -1;
                        }
                        else if (cursorManager.cursorIcons.Count > (useCursor_int - 1))
                        {
                            selectedItem.useIconID = cursorManager.cursorIcons[useCursor_int - 1].id;
                        }
                    }
                    else
                    {
                        selectedItem.useIconID = 0;
                    }
                    autoName = selectedItem.label + "_Examine";
                    selectedItem.lookActionList = ActionListAssetMenu.AssetGUI("Examine:", selectedItem.lookActionList, apiPrefix + ".lookActionList", autoName);
                }

                if (settingsManager.CanSelectItems(false))
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Unhandled interactions", CustomStyles.subHeader);
                    string autoName = selectedItem.label + "_Unhandled_Hotspot";
                    selectedItem.unhandledActionList = ActionListAssetMenu.AssetGUI("Unhandled use on Hotspot:", selectedItem.unhandledActionList, apiPrefix + ".unhandledActionList", autoName);
                    autoName = selectedItem.label + "_Unhandled_Combine";
                    selectedItem.unhandledCombineActionList = ActionListAssetMenu.AssetGUI("Unhandled combine:", selectedItem.unhandledCombineActionList, apiPrefix + ".unhandledCombineActionList", autoName);
                }

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Combine interactions", CustomStyles.subHeader);
                for (int i = 0; i < selectedItem.combineActionList.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    invNumber = GetArraySlot(selectedItem.combineID[i]);
                    invNumber = EditorGUILayout.Popup(invNumber, GetLabelList());
                    selectedItem.combineID[i] = items[invNumber].id;

                    string autoName = selectedItem.label + "_Combine_" + GetLabelList() [invNumber];
                    selectedItem.combineActionList[i] = ActionListAssetMenu.AssetGUI("", selectedItem.combineActionList[i], apiPrefix + ".combineActionList[" + i + "]", autoName);

                    if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                    {
                        Undo.RecordObject(this, "Delete combine event");
                        selectedItem.combineActionList.RemoveAt(i);
                        selectedItem.combineID.RemoveAt(i);
                        break;
                    }
                    EditorGUILayout.EndHorizontal();
                }
                if (GUILayout.Button("Add combine event"))
                {
                    Undo.RecordObject(this, "Add new combine event");
                    selectedItem.combineActionList.Add(null);
                    selectedItem.combineID.Add(0);
                }

                // List all "reverse" inventory combinations
                string reverseCombinations = "";
                foreach (InvItem otherItem in items)
                {
                    if (otherItem != selectedItem)
                    {
                        if (otherItem.combineID.Contains(selectedItem.id))
                        {
                            reverseCombinations += "- " + otherItem.label + "\n";
                            continue;
                        }
                    }
                }
                if (reverseCombinations.Length > 0)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.HelpBox("The following inventory items have combine interactions that reference this item:\n" + reverseCombinations, MessageType.Info);
                }

                if (invVars.Count > 0)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Properties", CustomStyles.subHeader);

                    RebuildProperties(selectedItem);

                    // UI for setting property values
                    if (selectedItem.vars.Count > 0)
                    {
                        foreach (InvVar invVar in selectedItem.vars)
                        {
                            string label = invVar.label + ":";
                            if (invVar.label.Length == 0)
                            {
                                label = "Property " + invVar.id.ToString() + ":";
                            }

                            if (invVar.type == VariableType.Boolean)
                            {
                                if (invVar.val != 1)
                                {
                                    invVar.val = 0;
                                }
                                invVar.val = CustomGUILayout.Popup(label, invVar.val, boolType, apiPrefix + ".GetProperty (" + invVar.id + ").val");
                            }
                            else if (invVar.type == VariableType.Integer)
                            {
                                invVar.val = CustomGUILayout.IntField(label, invVar.val, apiPrefix + ".GetProperty (" + invVar.id + ").val");
                            }
                            else if (invVar.type == VariableType.PopUp)
                            {
                                invVar.val = CustomGUILayout.Popup(label, invVar.val, invVar.popUps, apiPrefix + ".GetProperty (" + invVar.id + ").val");
                            }
                            else if (invVar.type == VariableType.String)
                            {
                                invVar.textVal = CustomGUILayout.TextField(label, invVar.textVal, apiPrefix + ".GetProperty (" + invVar.id + ").textVal");
                            }
                            else if (invVar.type == VariableType.Float)
                            {
                                invVar.floatVal = CustomGUILayout.FloatField(label, invVar.floatVal, apiPrefix + ".GetProperty (" + invVar.id + ").floatVal");
                            }
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("No properties have been defined that this inventory item can use.", MessageType.Info);
                    }
                }

                EditorGUILayout.EndVertical();
            }
        }
示例#9
0
        private void ItemsGUI()
        {
            EditorGUILayout.LabelField("Unhandled events", EditorStyles.boldLabel);
            unhandledCombine = ActionListAssetMenu.AssetGUI("Combine:", unhandledCombine);
            unhandledHotspot = ActionListAssetMenu.AssetGUI("Use on hotspot:", unhandledHotspot);
            if (settingsManager != null && settingsManager.CanGiveItems())
            {
                unhandledGive = ActionListAssetMenu.AssetGUI("Give to NPC:", unhandledGive);
            }

            List <string> binList = new List <string>();

            foreach (InvBin bin in bins)
            {
                binList.Add(bin.label);
            }

            EditorGUILayout.Space();
            CreateItemsGUI(binList.ToArray());
            EditorGUILayout.Space();

            if (selectedItem != null && items.Contains(selectedItem))
            {
                EditorGUILayout.LabelField("Inventory item '" + selectedItem.label + "' settings", EditorStyles.boldLabel);

                EditorGUILayout.BeginVertical("Button");
                selectedItem.label    = EditorGUILayout.TextField("Name:", selectedItem.label);
                selectedItem.altLabel = EditorGUILayout.TextField("Label (if not name):", selectedItem.altLabel);

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Category:", GUILayout.Width(146f));
                if (bins.Count > 0)
                {
                    binNumber          = GetBinSlot(selectedItem.binID);
                    binNumber          = EditorGUILayout.Popup(binNumber, binList.ToArray());
                    selectedItem.binID = bins[binNumber].id;
                }
                else
                {
                    selectedItem.binID = -1;
                    EditorGUILayout.LabelField("No categories defined!", EditorStyles.miniLabel, GUILayout.Width(146f));
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Main graphic:", GUILayout.Width(145));
                selectedItem.tex = (Texture2D)EditorGUILayout.ObjectField(selectedItem.tex, typeof(Texture2D), false, GUILayout.Width(70), GUILayout.Height(70));
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Active graphic:", GUILayout.Width(145));
                selectedItem.activeTex = (Texture2D)EditorGUILayout.ObjectField(selectedItem.activeTex, typeof(Texture2D), false, GUILayout.Width(70), GUILayout.Height(70));
                EditorGUILayout.EndHorizontal();

                if (AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.selectInventoryDisplay == SelectInventoryDisplay.ShowSelectedGraphic)
                {
                    selectedItem.selectedTex = (Texture2D)EditorGUILayout.ObjectField("Selected graphic:", selectedItem.selectedTex, typeof(Texture2D), false);
                }
                if (AdvGame.GetReferences().cursorManager != null)
                {
                    CursorManager cursorManager = AdvGame.GetReferences().cursorManager;
                    if (cursorManager.inventoryHandling == InventoryHandling.ChangeCursor || cursorManager.inventoryHandling == InventoryHandling.ChangeCursorAndHotspotLabel)
                    {
                        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                        selectedItem.cursorIcon.ShowGUI(true, cursorManager.cursorRendering, "Cursor (optional):");
                        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                    }
                }

                selectedItem.carryOnStart = EditorGUILayout.Toggle("Carry on start?", selectedItem.carryOnStart);
                if (selectedItem.carryOnStart && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.playerSwitching == PlayerSwitching.Allow && !AdvGame.GetReferences().settingsManager.shareInventory)
                {
                    selectedItem.carryOnStartNotDefault = EditorGUILayout.Toggle("Give to non-default player?", selectedItem.carryOnStartNotDefault);
                    if (selectedItem.carryOnStartNotDefault)
                    {
                        selectedItem.carryOnStartID = ChoosePlayerGUI(selectedItem.carryOnStartID);
                    }
                }

                selectedItem.canCarryMultiple = EditorGUILayout.Toggle("Can carry multiple?", selectedItem.canCarryMultiple);
                if (selectedItem.canCarryMultiple)
                {
                    selectedItem.useSeparateSlots = EditorGUILayout.Toggle("Place in separate slots?", selectedItem.useSeparateSlots);
                }
                if (selectedItem.carryOnStart && selectedItem.canCarryMultiple)
                {
                    selectedItem.count = EditorGUILayout.IntField("Quantity on start:", selectedItem.count);
                }
                else
                {
                    selectedItem.count = 1;
                }

                selectedItem.overrideUseSyntax = EditorGUILayout.Toggle("Override 'Use' syntax?", selectedItem.overrideUseSyntax);
                if (selectedItem.overrideUseSyntax)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Use syntax:", GUILayout.Width(100f));
                    selectedItem.hotspotPrefix1.label = EditorGUILayout.TextField(selectedItem.hotspotPrefix1.label, GUILayout.MaxWidth(80f));
                    EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f));
                    selectedItem.hotspotPrefix2.label = EditorGUILayout.TextField(selectedItem.hotspotPrefix2.label, GUILayout.MaxWidth(80f));
                    EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f));
                    EditorGUILayout.EndHorizontal();
                }

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Standard interactions", EditorStyles.boldLabel);
                if (settingsManager && settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && settingsManager.inventoryInteractions == InventoryInteractions.Multiple && AdvGame.GetReferences().cursorManager)
                {
                    CursorManager cursorManager = AdvGame.GetReferences().cursorManager;

                    List <string> iconList = new List <string>();
                    foreach (CursorIcon icon in cursorManager.cursorIcons)
                    {
                        iconList.Add(icon.label);
                    }

                    if (cursorManager.cursorIcons.Count > 0)
                    {
                        foreach (InvInteraction interaction in selectedItem.interactions)
                        {
                            EditorGUILayout.BeginHorizontal();
                            invNumber        = GetIconSlot(interaction.icon.id);
                            invNumber        = EditorGUILayout.Popup(invNumber, iconList.ToArray());
                            interaction.icon = cursorManager.cursorIcons[invNumber];

                            interaction.actionList = ActionListAssetMenu.AssetGUI("", interaction.actionList);

                            if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                            {
                                Undo.RecordObject(this, "Delete interaction");
                                selectedItem.interactions.Remove(interaction);
                                break;
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("No interaction icons defined - please use the Cursor Manager", MessageType.Warning);
                    }
                    if (GUILayout.Button("Add interaction"))
                    {
                        Undo.RecordObject(this, "Add new interaction");
                        selectedItem.interactions.Add(new InvInteraction(cursorManager.cursorIcons[0]));
                    }
                }
                else
                {
                    selectedItem.useActionList = ActionListAssetMenu.AssetGUI("Use:", selectedItem.useActionList);
                    if (cursorManager && cursorManager.allowInteractionCursorForInventory && cursorManager.cursorIcons.Count > 0)
                    {
                        int useCursor_int = cursorManager.GetIntFromID(selectedItem.useIconID);
                        useCursor_int          = EditorGUILayout.Popup("Use cursor icon:", useCursor_int, cursorManager.GetLabelsArray());
                        selectedItem.useIconID = cursorManager.cursorIcons[useCursor_int].id;
                    }
                    else
                    {
                        selectedItem.useIconID = 0;
                    }
                    selectedItem.lookActionList = ActionListAssetMenu.AssetGUI("Examine:", selectedItem.lookActionList);
                }

                if (settingsManager.CanSelectItems(false))
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Unhandled interactions", EditorStyles.boldLabel);
                    selectedItem.unhandledActionList        = ActionListAssetMenu.AssetGUI("Unhandled use on Hotspot:", selectedItem.unhandledActionList);
                    selectedItem.unhandledCombineActionList = ActionListAssetMenu.AssetGUI("Unhandled combine:", selectedItem.unhandledCombineActionList);
                }

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Combine interactions", EditorStyles.boldLabel);
                for (int i = 0; i < selectedItem.combineActionList.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    invNumber = GetArraySlot(selectedItem.combineID[i]);
                    invNumber = EditorGUILayout.Popup(invNumber, GetLabelList());
                    selectedItem.combineID[i] = items[invNumber].id;

                    selectedItem.combineActionList[i] = ActionListAssetMenu.AssetGUI("", selectedItem.combineActionList[i]);

                    if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                    {
                        Undo.RecordObject(this, "Delete combine event");
                        selectedItem.combineActionList.RemoveAt(i);
                        selectedItem.combineID.RemoveAt(i);
                        break;
                    }
                    EditorGUILayout.EndHorizontal();
                }
                if (GUILayout.Button("Add combine event"))
                {
                    Undo.RecordObject(this, "Add new combine event");
                    selectedItem.combineActionList.Add(null);
                    selectedItem.combineID.Add(0);
                }

                // List all "reverse" inventory combinations
                string reverseCombinations = "";
                foreach (InvItem otherItem in items)
                {
                    if (otherItem != selectedItem)
                    {
                        if (otherItem.combineID.Contains(selectedItem.id))
                        {
                            reverseCombinations += "- " + otherItem.label + "\n";
                            continue;
                        }
                    }
                }
                if (reverseCombinations.Length > 0)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.HelpBox("The following inventory items have combine interactions that reference this item:\n" + reverseCombinations, MessageType.Info);
                }

                if (invVars.Count > 0)
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Properties", EditorStyles.boldLabel);

                    RebuildProperties(selectedItem);

                    // UI for setting property values
                    if (selectedItem.vars.Count > 0)
                    {
                        foreach (InvVar invVar in selectedItem.vars)
                        {
                            string label = invVar.label + ":";
                            if (invVar.label.Length == 0)
                            {
                                label = "Property " + invVar.id.ToString() + ":";
                            }

                            if (invVar.type == VariableType.Boolean)
                            {
                                if (invVar.val != 1)
                                {
                                    invVar.val = 0;
                                }
                                invVar.val = EditorGUILayout.Popup(label, invVar.val, boolType);
                            }
                            else if (invVar.type == VariableType.Integer)
                            {
                                invVar.val = EditorGUILayout.IntField(label, invVar.val);
                            }
                            else if (invVar.type == VariableType.PopUp)
                            {
                                invVar.val = EditorGUILayout.Popup(label, invVar.val, invVar.popUps);
                            }
                            else if (invVar.type == VariableType.String)
                            {
                                invVar.textVal = EditorGUILayout.TextField(label, invVar.textVal);
                            }
                            else if (invVar.type == VariableType.Float)
                            {
                                invVar.floatVal = EditorGUILayout.FloatField(label, invVar.floatVal);
                            }
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("No properties have been defined that this inventory item can use.", MessageType.Info);
                    }
                }

                EditorGUILayout.EndVertical();
            }
        }
		private void GetCursorGUI ()
		{
			if (AdvGame.GetReferences ().cursorManager)
			{
				cursorManager = AdvGame.GetReferences ().cursorManager;

				if (cursorManager.cursorIcons.Count > 0)
				{
					int iconInt = cursorManager.GetIntFromID (iconID);
					iconInt = EditorGUILayout.Popup ("Cursor:", iconInt, cursorManager.GetLabelsArray (iconInt));
					iconID = cursorManager.cursorIcons [iconInt].id;
				}
				else
				{
					iconID = -1;
				}
			}
		}
示例#11
0
        public void OnAwake()
        {
            ClearVariables();

            // 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;
                CursorManager    cursorManager    = AdvGame.GetReferences().cursorManager;
                MenuManager      menuManager      = AdvGame.GetReferences().menuManager;

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

                if (settingsManager == null)
                {
                    ACDebug.LogError("No Settings Manager found - please set one using the Adventure Creator Kit wizard");
                }
                else
                {
                    if (settingsManager.IsInLoadingScene())
                    {
                        ACDebug.Log("Bypassing regular AC startup because the current scene is the 'Loading' scene.");
                        SetPersistentEngine();
                        return;
                    }

                    // Unity 5.3 has a bug whereby a modified Player prefab is placed in the scene when editing, but not visible
                    // This causes the Player to not load properly, so try to detect this remnant and delete it!
                    GameObject existingPlayer = GameObject.FindGameObjectWithTag(Tags.player);
                    if (existingPlayer != null)
                    {
                        if (settingsManager.GetDefaultPlayer() != null && existingPlayer.name == (settingsManager.GetDefaultPlayer().name + "(Clone)"))
                        {
                            DestroyImmediate(GameObject.FindGameObjectWithTag(Tags.player));
                            ACDebug.LogWarning("Player clone found in scene - this may have been hidden by a Unity bug, and has been destroyed.");
                        }
                    }

                    if (!GameObject.FindGameObjectWithTag(Tags.player))
                    {
                        KickStarter.ResetPlayer(settingsManager.GetDefaultPlayer(), settingsManager.GetDefaultPlayerID(), false, Quaternion.identity);
                    }
                    else
                    {
                        KickStarter.playerPrefab = GameObject.FindWithTag(Tags.player).GetComponent <Player>();

                        if (sceneChanger == null || sceneChanger.GetPlayerOnTransition() == null)
                        {
                            // New local player
                            if (KickStarter.playerPrefab != null)
                            {
                                KickStarter.playerPrefab.Initialise();
                            }
                        }

                        AssignLocalPlayer();
                    }
                }

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

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

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

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

                if (cursorManager == null)
                {
                    ACDebug.LogError("No Cursor Manager found - please set one using the main Adventure Creator window");
                }

                if (menuManager == null)
                {
                    ACDebug.LogError("No Menu Manager found - please set one using the main Adventure Creator window");
                }

                if (GameObject.FindWithTag(Tags.player) == null && KickStarter.settingsManager.movementMethod != MovementMethod.None)
                {
                    ACDebug.LogWarning("No Player found - please set one using the Settings Manager, tagging it as Player and placing it in a Resources folder");
                }
            }
            else
            {
                ACDebug.LogError("No References object found. Please set one using the main Adventure Creator window");
            }

            SetPersistentEngine();

            if (persistentEnginePrefab == null)
            {
                ACDebug.LogError("No PersistentEngine prefab found - please place one in the Resources directory, and tag it as PersistentEngine");
            }
            else
            {
                if (persistentEnginePrefab.GetComponent <Options>() == null)
                {
                    ACDebug.LogError(persistentEnginePrefab.name + " has no Options component attached.");
                }
                if (persistentEnginePrefab.GetComponent <RuntimeInventory>() == null)
                {
                    ACDebug.LogError(persistentEnginePrefab.name + " has no RuntimeInventory component attached.");
                }
                if (persistentEnginePrefab.GetComponent <RuntimeVariables>() == null)
                {
                    ACDebug.LogError(persistentEnginePrefab.name + " has no RuntimeVariables component attached.");
                }
                if (persistentEnginePrefab.GetComponent <PlayerMenus>() == null)
                {
                    ACDebug.LogError(persistentEnginePrefab.name + " has no PlayerMenus component attached.");
                }
                if (persistentEnginePrefab.GetComponent <StateHandler>() == null)
                {
                    ACDebug.LogError(persistentEnginePrefab.name + " has no StateHandler component attached.");
                }
                if (persistentEnginePrefab.GetComponent <SceneChanger>() == null)
                {
                    ACDebug.LogError(persistentEnginePrefab.name + " has no SceneChanger component attached.");
                }
                if (persistentEnginePrefab.GetComponent <SaveSystem>() == null)
                {
                    ACDebug.LogError(persistentEnginePrefab.name + " has no SaveSystem component attached.");
                }
                if (persistentEnginePrefab.GetComponent <LevelStorage>() == null)
                {
                    ACDebug.LogError(persistentEnginePrefab.name + " has no LevelStorage component attached.");
                }
                if (persistentEnginePrefab.GetComponent <RuntimeLanguages>() == null)
                {
                    ACDebug.LogError(persistentEnginePrefab.name + " has no RuntimeLanguages component attached.");
                }
                if (persistentEnginePrefab.GetComponent <ActionListAssetManager>() == null)
                {
                    ACDebug.LogError(persistentEnginePrefab.name + " has no ActionListAssetManager component attached.");
                }
            }

            if (this.GetComponent <MenuSystem>() == null)
            {
                ACDebug.LogError(this.name + " has no MenuSystem component attached.");
            }
            if (this.GetComponent <Dialog>() == null)
            {
                ACDebug.LogError(this.name + " has no Dialog component attached.");
            }
            if (this.GetComponent <PlayerInput>() == null)
            {
                ACDebug.LogError(this.name + " has no PlayerInput component attached.");
            }
            if (this.GetComponent <PlayerInteraction>() == null)
            {
                ACDebug.LogError(this.name + " has no PlayerInteraction component attached.");
            }
            if (this.GetComponent <PlayerMovement>() == null)
            {
                ACDebug.LogError(this.name + " has no PlayerMovement component attached.");
            }
            if (this.GetComponent <PlayerCursor>() == null)
            {
                ACDebug.LogError(this.name + " has no PlayerCursor component attached.");
            }
            if (this.GetComponent <PlayerQTE>() == null)
            {
                ACDebug.LogError(this.name + " has no PlayerQTE component attached.");
            }
            if (this.GetComponent <SceneSettings>() == null)
            {
                ACDebug.LogError(this.name + " has no SceneSettings component attached.");
            }
            else
            {
                if (this.GetComponent <SceneSettings>().navigationMethod == AC_NavigationMethod.meshCollider && this.GetComponent <SceneSettings>().navMesh == null)
                {
                    // No NavMesh, are there Characters in the scene?
                    AC.Char[] allChars = GameObject.FindObjectsOfType(typeof(AC.Char)) as AC.Char[];
                    if (allChars.Length > 0)
                    {
                        ACDebug.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)
                {
                    if (AdvGame.GetReferences().settingsManager == null || AdvGame.GetReferences().settingsManager.GetDefaultPlayer() != null)
                    {
                        ACDebug.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 <NavigationManager>() == null)
            {
                ACDebug.LogError(this.name + " has no NavigationManager component attached.");
            }
            if (this.GetComponent <ActionListManager>() == null)
            {
                ACDebug.LogError(this.name + " has no ActionListManager component attached.");
            }
            if (this.GetComponent <EventManager>() == null)
            {
                ACDebug.LogError(this.name + " has no EventManager component attached.");
            }
        }
示例#12
0
		private void GetReferences ()
		{
			settingsManager = AdvGame.GetReferences ().settingsManager;
			if (settingsManager.IsInLoadingScene ())
			{
				return;
			}
			
			speechManager = AdvGame.GetReferences ().speechManager;
			cursorManager = AdvGame.GetReferences ().cursorManager;
			menuManager = AdvGame.GetReferences ().menuManager;
			
			playerCursor = GameObject.FindWithTag (Tags.gameEngine).GetComponent <PlayerCursor>();
			actionListManager = playerCursor.GetComponent <ActionListManager>();
			playerInput = playerCursor.GetComponent <PlayerInput>();
			playerInteraction = playerCursor.GetComponent <PlayerInteraction>();
			menuSystem = playerCursor.GetComponent <MenuSystem>();
			dialog = playerCursor.GetComponent <Dialog>();
			sceneSettings = playerCursor.GetComponent <SceneSettings>();
			
			stateHandler = this.GetComponent <StateHandler>();
			options = this.GetComponent <Options>();
			runtimeInventory = this.GetComponent <RuntimeInventory>();
		}
		public void ShowGUI ()
		{
			if (!sideIcon)
			{
				sideIcon = (Texture2D) AssetDatabase.LoadAssetAtPath ("Assets/AdventureCreator/Graphics/Textures/inspector-use.png", typeof (Texture2D));
			}

			if (AdvGame.GetReferences ())
			{
				if (AdvGame.GetReferences ().settingsManager)
				{
					settingsManager = AdvGame.GetReferences ().settingsManager;
				}
				if (AdvGame.GetReferences ().cursorManager)
				{
					cursorManager = AdvGame.GetReferences ().cursorManager;
				}
			}

			BinsGUI ();

			if (settingsManager == null || settingsManager.interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction || (settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction && settingsManager.inventoryInteractions == InventoryInteractions.Single))
			{
				EditorGUILayout.Space ();
				EditorGUILayout.LabelField ("Unhandled events", EditorStyles.boldLabel);
				unhandledCombine = (ActionListAsset) EditorGUILayout.ObjectField ("Combine:", unhandledCombine, typeof (ActionListAsset), false);
				unhandledHotspot = (ActionListAsset) EditorGUILayout.ObjectField ("Use on hotspot:", unhandledHotspot, typeof (ActionListAsset), false);
			}

			List<string> binList = new List<string>();
			foreach (InvBin bin in bins)
			{
				binList.Add (bin.label);
			}
			
			EditorGUILayout.Space ();
			CreateItemsGUI ();
			EditorGUILayout.Space ();

			if (selectedItem != null && items.Contains (selectedItem))
			{
				EditorGUILayout.LabelField ("Inventory item '" + selectedItem.label + "' properties", EditorStyles.boldLabel);

				EditorGUILayout.BeginVertical("Button");
					selectedItem.label = EditorGUILayout.TextField ("Name:", selectedItem.label);
					selectedItem.altLabel = EditorGUILayout.TextField ("Label (if not name):", selectedItem.altLabel);

					EditorGUILayout.BeginHorizontal ();
						EditorGUILayout.LabelField ("Category:", GUILayout.Width (146f));
						if (bins.Count > 0)
						{
							binNumber = GetBinSlot (selectedItem.binID);
							binNumber = EditorGUILayout.Popup (binNumber, binList.ToArray());
							selectedItem.binID = bins[binNumber].id;
						}
						else
						{
							selectedItem.binID = -1;
							EditorGUILayout.LabelField ("No categories defined!", EditorStyles.miniLabel, GUILayout.Width (146f));
						}
					EditorGUILayout.EndHorizontal ();	

					selectedItem.tex = (Texture2D) EditorGUILayout.ObjectField ("Texture:", selectedItem.tex, typeof (Texture2D), false);

					if (settingsManager && (settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive || settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot || (settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction && settingsManager.inventoryInteractions == InventoryInteractions.Single)))
					{
						selectedItem.activeTex = (Texture2D) EditorGUILayout.ObjectField ("Active texture:", selectedItem.activeTex, typeof (Texture2D), false);
					}

					selectedItem.carryOnStart = EditorGUILayout.Toggle ("Carry on start?", selectedItem.carryOnStart);
					selectedItem.canCarryMultiple = EditorGUILayout.Toggle ("Can carry multiple?", selectedItem.canCarryMultiple);
					if (selectedItem.canCarryMultiple)
					{
						selectedItem.useSeparateSlots = EditorGUILayout.Toggle ("Place in separate slots?", selectedItem.useSeparateSlots);
					}
					if (selectedItem.carryOnStart && selectedItem.canCarryMultiple)
					{
						selectedItem.count = EditorGUILayout.IntField ("Quantity on start:", selectedItem.count);
					}
					else
					{
						selectedItem.count = 1;
					}

					EditorGUILayout.Space ();
					EditorGUILayout.LabelField ("Standard interactions", EditorStyles.boldLabel);
					if (settingsManager && settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && settingsManager.inventoryInteractions == InventoryInteractions.Multiple && AdvGame.GetReferences ().cursorManager)
					{
						CursorManager cursorManager = AdvGame.GetReferences ().cursorManager;

						List<string> iconList = new List<string>();
						foreach (CursorIcon icon in cursorManager.cursorIcons)
						{
							iconList.Add (icon.label);
						}

						if (cursorManager.cursorIcons.Count > 0)
						{
							foreach (InvInteraction interaction in selectedItem.interactions)
							{
								EditorGUILayout.BeginHorizontal ();
								invNumber = GetIconSlot (interaction.icon.id);
								invNumber = EditorGUILayout.Popup (invNumber, iconList.ToArray());
								interaction.icon = cursorManager.cursorIcons[invNumber];

								interaction.actionList = (ActionListAsset) EditorGUILayout.ObjectField (interaction.actionList, typeof (ActionListAsset), false);
								
								if (GUILayout.Button (deleteContent, EditorStyles.miniButtonRight, buttonWidth))
								{
									Undo.RecordObject (this, "Delete interaction");
									selectedItem.interactions.Remove (interaction);
									break;
								}
								EditorGUILayout.EndHorizontal ();
							}
						}
						else
						{
							EditorGUILayout.HelpBox ("No interaction icons defined - please use the Cursor Manager", MessageType.Warning);
						}
						if (GUILayout.Button ("Add interaction"))
						{
							Undo.RecordObject (this, "Add new interaction");
							selectedItem.interactions.Add (new InvInteraction (cursorManager.cursorIcons[0]));
						}
					}
					else
					{
						selectedItem.useActionList = (ActionListAsset) EditorGUILayout.ObjectField ("Use:", selectedItem.useActionList, typeof (ActionListAsset), false);
						if (cursorManager && cursorManager.allowInteractionCursorForInventory && cursorManager.cursorIcons.Count > 0)
						{
							int useCursor_int = cursorManager.GetIntFromID (selectedItem.useIconID);
							useCursor_int = EditorGUILayout.Popup ("Use cursor icon:", useCursor_int, cursorManager.GetLabelsArray (useCursor_int));
							selectedItem.useIconID = cursorManager.cursorIcons[useCursor_int].id;
						}
						else
						{
							selectedItem.useIconID = 0;
						}
						selectedItem.lookActionList = (ActionListAsset) EditorGUILayout.ObjectField ("Examine:", selectedItem.lookActionList, typeof (ActionListAsset), false);
						selectedItem.unhandledActionList = (ActionListAsset) EditorGUILayout.ObjectField ("Unhandled use on Hotspot:", selectedItem.unhandledActionList, typeof (ActionListAsset), false);
						selectedItem.unhandledCombineActionList = (ActionListAsset) EditorGUILayout.ObjectField ("Unhandled combine:", selectedItem.unhandledCombineActionList, typeof (ActionListAsset), false);
					}
					
					EditorGUILayout.Space ();
					EditorGUILayout.LabelField ("Combine interactions", EditorStyles.boldLabel);
					for (int i=0; i<selectedItem.combineActionList.Count; i++)
					{
						EditorGUILayout.BeginHorizontal ();
							invNumber = GetArraySlot (selectedItem.combineID[i]);
							invNumber = EditorGUILayout.Popup (invNumber, GetLabelList ());
							selectedItem.combineID[i] = items[invNumber].id;
						
							selectedItem.combineActionList[i] = (ActionListAsset) EditorGUILayout.ObjectField (selectedItem.combineActionList[i], typeof (ActionListAsset), false);
						
							if (GUILayout.Button (deleteContent, EditorStyles.miniButtonRight, buttonWidth))
							{
								Undo.RecordObject (this, "Delete combine event");
								selectedItem.combineActionList.RemoveAt (i);
								selectedItem.combineID.RemoveAt (i);
								break;
							}
						EditorGUILayout.EndHorizontal ();
					}
					if (GUILayout.Button ("Add combine event"))
					{
						Undo.RecordObject (this, "Add new combine event");
						selectedItem.combineActionList.Add (null);
						selectedItem.combineID.Add (0);
					}
					
				EditorGUILayout.EndVertical();
				EditorGUILayout.Space ();
			}

			CraftingGUI ();
			
			if (GUI.changed)
			{
				EditorUtility.SetDirty (this);
			}
		}
示例#14
0
        public void ShowGUI()
        {
            EditorGUILayout.LabelField("Save game settings", EditorStyles.boldLabel);

            if (saveFileName == "")
            {
                saveFileName = SaveSystem.SetProjectName();
            }
            saveFileName = EditorGUILayout.TextField("Save filename:", saveFileName);
                        #if !UNITY_WEBPLAYER && !UNITY_ANDROID
            saveTimeDisplay     = (SaveTimeDisplay)EditorGUILayout.EnumPopup("Time display:", saveTimeDisplay);
            takeSaveScreenshots = EditorGUILayout.ToggleLeft("Take screenshot when saving?", takeSaveScreenshots);
                        #else
            EditorGUILayout.HelpBox("Save-game screenshots are disabled for WebPlayer and Android platforms.", MessageType.Info);
            takeSaveScreenshots = false;
                        #endif

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Cutscene settings:", EditorStyles.boldLabel);

            actionListOnStart    = ActionListAssetMenu.AssetGUI("ActionList on start game:", actionListOnStart);
            blackOutWhenSkipping = EditorGUILayout.Toggle("Black out when skipping?", blackOutWhenSkipping);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Character settings:", EditorStyles.boldLabel);

            CreatePlayersGUI();

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Interface settings", EditorStyles.boldLabel);

            movementMethod = (MovementMethod)EditorGUILayout.EnumPopup("Movement method:", movementMethod);
            if (movementMethod == MovementMethod.UltimateFPS && !UltimateFPSIntegration.IsDefinePresent())
            {
                EditorGUILayout.HelpBox("The 'UltimateFPSIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
            }

            inputMethod       = (InputMethod)EditorGUILayout.EnumPopup("Input method:", inputMethod);
            interactionMethod = (AC_InteractionMethod)EditorGUILayout.EnumPopup("Interaction method:", interactionMethod);

            if (inputMethod != InputMethod.TouchScreen)
            {
                useOuya = EditorGUILayout.ToggleLeft("Playing on OUYA platform?", useOuya);
                if (useOuya && !OuyaIntegration.IsDefinePresent())
                {
                    EditorGUILayout.HelpBox("The 'OUYAIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
                }
                if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    selectInteractions = (SelectInteractions)EditorGUILayout.EnumPopup("Select Interactions by:", selectInteractions);
                    if (selectInteractions != SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        seeInteractions = (SeeInteractions)EditorGUILayout.EnumPopup("See Interactions with:", seeInteractions);
                        if (seeInteractions == SeeInteractions.ClickOnHotspot)
                        {
                            stopPlayerOnClickHotspot = EditorGUILayout.ToggleLeft("Stop player moving when click Hotspot?", stopPlayerOnClickHotspot);
                        }
                    }

                    if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        autoCycleWhenInteract = EditorGUILayout.ToggleLeft("Auto-cycle after an Interaction?", autoCycleWhenInteract);
                    }

                    if (SelectInteractionMethod() == SelectInteractions.ClickingMenu)
                    {
                        cancelInteractions = (CancelInteractions)EditorGUILayout.EnumPopup("Close interactions with:", cancelInteractions);
                    }
                    else
                    {
                        cancelInteractions = CancelInteractions.CursorLeavesMenu;
                    }
                }
            }
            if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
            {
                autoCycleWhenInteract = EditorGUILayout.ToggleLeft("Reset cursor after an Interaction?", autoCycleWhenInteract);
            }
            lockCursorOnStart = EditorGUILayout.ToggleLeft("Lock cursor in screen's centre when game begins?", lockCursorOnStart);
            hideLockedCursor  = EditorGUILayout.ToggleLeft("Hide cursor when locked in screen's centre?", hideLockedCursor);
            onlyInteractWhenCursorUnlocked = EditorGUILayout.ToggleLeft("Disallow Interactions if cursor is unlocked?", onlyInteractWhenCursorUnlocked);
            if (IsInFirstPerson())
            {
                disableFreeAimWhenDragging = EditorGUILayout.ToggleLeft("Disable free-aim when dragging?", disableFreeAimWhenDragging);
            }
            if (inputMethod != InputMethod.TouchScreen)
            {
                runConversationsWithKeys = EditorGUILayout.ToggleLeft("Dialogue options can be selected with number keys?", runConversationsWithKeys);
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Inventory settings", EditorStyles.boldLabel);

            if (interactionMethod != AC_InteractionMethod.ContextSensitive)
            {
                inventoryInteractions = (InventoryInteractions)EditorGUILayout.EnumPopup("Inventory interactions:", inventoryInteractions);

                if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot)
                    {
                        cycleInventoryCursors = EditorGUILayout.ToggleLeft("Include Inventory items in Interaction cycles?", cycleInventoryCursors);
                    }
                    else
                    {
                        cycleInventoryCursors = EditorGUILayout.ToggleLeft("Include Inventory items in Interaction menus?", cycleInventoryCursors);
                    }
                }

                if (inventoryInteractions == InventoryInteractions.Multiple && CanSelectItems(false))
                {
                    selectInvWithUnhandled = EditorGUILayout.ToggleLeft("Select item if Interaction is unhandled?", selectInvWithUnhandled);
                    if (selectInvWithUnhandled)
                    {
                        CursorManager cursorManager = AdvGame.GetReferences().cursorManager;
                        if (cursorManager != null && cursorManager.cursorIcons != null && cursorManager.cursorIcons.Count > 0)
                        {
                            selectInvWithIconID = GetIconID("Select with unhandled:", selectInvWithIconID, cursorManager);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("No Interaction cursors defined - please do so in the Cursor Manager.", MessageType.Info);
                        }
                    }

                    giveInvWithUnhandled = EditorGUILayout.ToggleLeft("Give item if Interaction is unhandled?", giveInvWithUnhandled);
                    if (giveInvWithUnhandled)
                    {
                        CursorManager cursorManager = AdvGame.GetReferences().cursorManager;
                        if (cursorManager != null && cursorManager.cursorIcons != null && cursorManager.cursorIcons.Count > 0)
                        {
                            giveInvWithIconID = GetIconID("Give with unhandled:", giveInvWithIconID, cursorManager);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("No Interaction cursors defined - please do so in the Cursor Manager.", MessageType.Info);
                        }
                    }
                }
            }

            if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction && selectInteractions != SelectInteractions.ClickingMenu && inventoryInteractions == InventoryInteractions.Multiple)
            {
            }
            else
            {
                reverseInventoryCombinations = EditorGUILayout.ToggleLeft("Combine interactions work in reverse?", reverseInventoryCombinations);
            }

            //if (interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction || inventoryInteractions == InventoryInteractions.Single)
            if (CanSelectItems(false))
            {
                inventoryDragDrop = EditorGUILayout.ToggleLeft("Drag and drop Inventory interface?", inventoryDragDrop);
                if (!inventoryDragDrop)
                {
                    if (interactionMethod == AC_InteractionMethod.ContextSensitive || inventoryInteractions == InventoryInteractions.Single)
                    {
                        rightClickInventory = (RightClickInventory)EditorGUILayout.EnumPopup("Right-click active item:", rightClickInventory);
                    }
                }
                else if (inventoryInteractions == AC.InventoryInteractions.Single)
                {
                    inventoryDropLook = EditorGUILayout.ToggleLeft("Can drop an Item onto itself to Examine it?", inventoryDropLook);
                }
            }

            if (CanSelectItems(false) && !inventoryDragDrop)
            {
                inventoryDisableLeft = EditorGUILayout.ToggleLeft("Left-click deselects active item?", inventoryDisableLeft);

                if (movementMethod == MovementMethod.PointAndClick && !inventoryDisableLeft)
                {
                    canMoveWhenActive = EditorGUILayout.ToggleLeft("Can move player if an Item is active?", canMoveWhenActive);
                }
            }

            inventoryActiveEffect = (InventoryActiveEffect)EditorGUILayout.EnumPopup("Active cursor FX:", inventoryActiveEffect);
            if (inventoryActiveEffect == InventoryActiveEffect.Pulse)
            {
                inventoryPulseSpeed = EditorGUILayout.Slider("Active FX pulse speed:", inventoryPulseSpeed, 0.5f, 2f);
            }

            activeWhenUnhandled  = EditorGUILayout.ToggleLeft("Show Active FX when an Interaction is unhandled?", activeWhenUnhandled);
            canReorderItems      = EditorGUILayout.ToggleLeft("Items can be re-ordered in Menu?", canReorderItems);
            hideSelectedFromMenu = EditorGUILayout.ToggleLeft("Hide currently active Item in Menu?", hideSelectedFromMenu);
            activeWhenHover      = EditorGUILayout.ToggleLeft("Show Active FX when Cursor hovers over Item in Menu?", activeWhenHover);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Required inputs:", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("The following inputs are available for the chosen interface settings:" + GetInputList(), MessageType.Info);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Movement settings", EditorStyles.boldLabel);

            if ((inputMethod == InputMethod.TouchScreen && movementMethod != MovementMethod.PointAndClick) || movementMethod == MovementMethod.Drag)
            {
                dragWalkThreshold = EditorGUILayout.FloatField("Walk threshold:", dragWalkThreshold);
                dragRunThreshold  = EditorGUILayout.FloatField("Run threshold:", dragRunThreshold);

                if (inputMethod == InputMethod.TouchScreen && movementMethod == MovementMethod.FirstPerson)
                {
                    freeAimTouchSpeed = EditorGUILayout.FloatField("Freelook speed:", freeAimTouchSpeed);
                }

                drawDragLine = EditorGUILayout.Toggle("Draw drag line?", drawDragLine);
                if (drawDragLine)
                {
                    dragLineWidth = EditorGUILayout.FloatField("Drag line width:", dragLineWidth);
                    dragLineColor = EditorGUILayout.ColorField("Drag line colour:", dragLineColor);
                }
            }
            else if (movementMethod == MovementMethod.Direct)
            {
                magnitudeAffectsDirect = EditorGUILayout.ToggleLeft("Input magnitude affects speed?", magnitudeAffectsDirect);
                directMovementType     = (DirectMovementType)EditorGUILayout.EnumPopup("Direct-movement type:", directMovementType);
                if (directMovementType == DirectMovementType.RelativeToCamera)
                {
                    limitDirectMovement = (LimitDirectMovement)EditorGUILayout.EnumPopup("Movement limitation:", limitDirectMovement);
                    if (cameraPerspective == CameraPerspective.ThreeD)
                    {
                        directMovementPerspective = EditorGUILayout.ToggleLeft("Account for player's position on screen?", directMovementPerspective);
                    }
                }
            }
            else if (movementMethod == MovementMethod.PointAndClick)
            {
                clickPrefab         = (Transform)EditorGUILayout.ObjectField("Click marker:", clickPrefab, typeof(Transform), false);
                walkableClickRange  = EditorGUILayout.Slider("NavMesh search %:", walkableClickRange, 0f, 1f);
                doubleClickMovement = EditorGUILayout.Toggle("Double-click to move?", doubleClickMovement);
            }
            if (movementMethod == MovementMethod.StraightToCursor)
            {
                dragRunThreshold  = EditorGUILayout.FloatField("Run threshold:", dragRunThreshold);
                singleTapStraight = EditorGUILayout.ToggleLeft("Single-clicking also moves player?", singleTapStraight);
                if (singleTapStraight)
                {
                    singleTapStraightPathfind = EditorGUILayout.ToggleLeft("Pathfind when single-clicking?", singleTapStraightPathfind);
                }
            }
            if (movementMethod == MovementMethod.FirstPerson && inputMethod == InputMethod.TouchScreen)
            {
                dragAffects = (DragAffects)EditorGUILayout.EnumPopup("Touch-drag affects:", dragAffects);
            }
            if ((movementMethod == MovementMethod.Direct || movementMethod == MovementMethod.FirstPerson) && inputMethod != InputMethod.TouchScreen)
            {
                jumpSpeed = EditorGUILayout.Slider("Jump speed:", jumpSpeed, 1f, 10f);
            }

            destinationAccuracy = EditorGUILayout.Slider("Destination accuracy:", destinationAccuracy, 0f, 1f);

            if (inputMethod == InputMethod.TouchScreen)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Touch Screen settings", EditorStyles.boldLabel);

                offsetTouchCursor = EditorGUILayout.Toggle("Drag cursor with touch?", offsetTouchCursor);
                doubleTapHotspots = EditorGUILayout.Toggle("Double-tap Hotspots?", doubleTapHotspots);
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Camera settings", EditorStyles.boldLabel);

            cameraPerspective_int = (int)cameraPerspective;
            cameraPerspective_int = EditorGUILayout.Popup("Camera perspective:", cameraPerspective_int, cameraPerspective_list);
            cameraPerspective     = (CameraPerspective)cameraPerspective_int;
            if (movementMethod == MovementMethod.FirstPerson)
            {
                cameraPerspective = CameraPerspective.ThreeD;
            }
            if (cameraPerspective == CameraPerspective.TwoD)
            {
                movingTurning = (MovingTurning)EditorGUILayout.EnumPopup("Moving and turning:", movingTurning);
                if (movingTurning == MovingTurning.TopDown || movingTurning == MovingTurning.Unity2D)
                {
                    verticalReductionFactor = EditorGUILayout.Slider("Vertical movement factor:", verticalReductionFactor, 0.1f, 1f);
                }
            }

            forceAspectRatio = EditorGUILayout.Toggle("Force aspect ratio?", forceAspectRatio);
            if (forceAspectRatio)
            {
                wantedAspectRatio = EditorGUILayout.FloatField("Aspect ratio:", wantedAspectRatio);
                                #if UNITY_IPHONE
                landscapeModeOnly = EditorGUILayout.Toggle("Landscape-mode only?", landscapeModeOnly);
                                #endif
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Hotpot settings", EditorStyles.boldLabel);

            hotspotDetection = (HotspotDetection)EditorGUILayout.EnumPopup("Hotspot detection method:", hotspotDetection);
            if (hotspotDetection == HotspotDetection.PlayerVicinity && (movementMethod == MovementMethod.Direct || IsInFirstPerson()))
            {
                hotspotsInVicinity = (HotspotsInVicinity)EditorGUILayout.EnumPopup("Hotspots in vicinity:", hotspotsInVicinity);
            }
            else if (hotspotDetection == HotspotDetection.MouseOver)
            {
                scaleHighlightWithMouseProximity = EditorGUILayout.ToggleLeft("Highlight Hotspots based on cursor proximity?", scaleHighlightWithMouseProximity);
                if (scaleHighlightWithMouseProximity)
                {
                    highlightProximityFactor = EditorGUILayout.FloatField("Cursor proximity factor:", highlightProximityFactor);
                }
            }

            if (cameraPerspective != CameraPerspective.TwoD)
            {
                playerFacesHotspots = EditorGUILayout.Toggle("Player turns head to active?", playerFacesHotspots);
            }

            hotspotIconDisplay = (HotspotIconDisplay)EditorGUILayout.EnumPopup("Display Hotspot icon:", hotspotIconDisplay);
            if (hotspotIconDisplay != HotspotIconDisplay.Never)
            {
                if (cameraPerspective != CameraPerspective.TwoD)
                {
                    occludeIcons = EditorGUILayout.Toggle("Don't show behind Colliders?", occludeIcons);
                }
                hotspotIcon = (HotspotIcon)EditorGUILayout.EnumPopup("Hotspot icon type:", hotspotIcon);
                if (hotspotIcon == HotspotIcon.Texture)
                {
                    hotspotIconTexture = (Texture2D)EditorGUILayout.ObjectField("Hotspot icon texture:", hotspotIconTexture, typeof(Texture2D), false);
                }
                hotspotIconSize = EditorGUILayout.FloatField("Hotspot icon size:", hotspotIconSize);
            }

                        #if UNITY_5
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Audio settings", EditorStyles.boldLabel);
            volumeControl = (VolumeControl)EditorGUILayout.EnumPopup("Volume controlled by:", volumeControl);
            if (volumeControl == VolumeControl.AudioMixerGroups)
            {
                musicMixerGroup             = (AudioMixerGroup)EditorGUILayout.ObjectField("Music mixer:", musicMixerGroup, typeof(AudioMixerGroup), false);
                sfxMixerGroup               = (AudioMixerGroup)EditorGUILayout.ObjectField("SFX mixer:", sfxMixerGroup, typeof(AudioMixerGroup), false);
                speechMixerGroup            = (AudioMixerGroup)EditorGUILayout.ObjectField("Speech mixer:", speechMixerGroup, typeof(AudioMixerGroup), false);
                musicAttentuationParameter  = EditorGUILayout.TextField("Music atten. parameter:", musicAttentuationParameter);
                sfxAttentuationParameter    = EditorGUILayout.TextField("SFX atten. parameter:", sfxAttentuationParameter);
                speechAttentuationParameter = EditorGUILayout.TextField("Speech atten. parameter:", speechAttentuationParameter);
            }
                        #endif

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Raycast settings", EditorStyles.boldLabel);
            navMeshRaycastLength  = EditorGUILayout.FloatField("NavMesh ray length:", navMeshRaycastLength);
            hotspotRaycastLength  = EditorGUILayout.FloatField("Hotspot ray length:", hotspotRaycastLength);
            moveableRaycastLength = EditorGUILayout.FloatField("Moveable ray length:", moveableRaycastLength);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Layer names", EditorStyles.boldLabel);

            hotspotLayer = EditorGUILayout.TextField("Hotspot:", hotspotLayer);
            navMeshLayer = EditorGUILayout.TextField("Nav mesh:", navMeshLayer);
            if (cameraPerspective == CameraPerspective.TwoPointFiveD)
            {
                backgroundImageLayer = EditorGUILayout.TextField("Background image:", backgroundImageLayer);
            }
            deactivatedLayer = EditorGUILayout.TextField("Deactivated:", deactivatedLayer);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Loading scene", EditorStyles.boldLabel);
            useLoadingScreen = EditorGUILayout.Toggle("Use loading screen?", useLoadingScreen);
            if (useLoadingScreen)
            {
                loadingSceneIs = (ChooseSceneBy)EditorGUILayout.EnumPopup("Choose loading scene by:", loadingSceneIs);
                if (loadingSceneIs == ChooseSceneBy.Name)
                {
                    loadingSceneName = EditorGUILayout.TextField("Loading scene name:", loadingSceneName);
                }
                else
                {
                    loadingScene = EditorGUILayout.IntField("Loading screen scene:", loadingScene);
                }
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Options data", EditorStyles.boldLabel);

            if (!PlayerPrefs.HasKey(ppKey))
            {
                optionsData   = new OptionsData();
                optionsBinary = Serializer.SerializeObjectBinary(optionsData);
                PlayerPrefs.SetString(ppKey, optionsBinary);
            }

            optionsBinary = PlayerPrefs.GetString(ppKey);
            if (optionsBinary.Length > 0)
            {
                optionsData = Serializer.DeserializeObjectBinary <OptionsData> (optionsBinary);
            }
            else
            {
                optionsData = new OptionsData();
            }

            defaultSpeechVolume  = optionsData.speechVolume = EditorGUILayout.Slider("Speech volume:", optionsData.speechVolume, 0f, 1f);
            defaultMusicVolume   = optionsData.musicVolume = EditorGUILayout.Slider("Music volume:", optionsData.musicVolume, 0f, 1f);
            defaultSfxVolume     = optionsData.sfxVolume = EditorGUILayout.Slider("SFX volume:", optionsData.sfxVolume, 0f, 1f);
            defaultShowSubtitles = optionsData.showSubtitles = EditorGUILayout.Toggle("Show subtitles?", optionsData.showSubtitles);
            defaultLanguage      = optionsData.language = EditorGUILayout.IntField("Language:", optionsData.language);

            optionsBinary = Serializer.SerializeObjectBinary(optionsData);
            PlayerPrefs.SetString(ppKey, optionsBinary);

            if (GUILayout.Button("Reset options data"))
            {
                PlayerPrefs.DeleteKey("Options");
                optionsData = new OptionsData();
                Debug.Log("PlayerPrefs cleared");
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Debug settings", EditorStyles.boldLabel);
            showActiveActionLists = EditorGUILayout.ToggleLeft("List active ActionLists in Game window?", showActiveActionLists);
            showHierarchyIcons    = EditorGUILayout.ToggleLeft("Show icons in Hierarchy window?", showHierarchyIcons);


            if (GUI.changed)
            {
                EditorUtility.SetDirty(this);
            }
        }
示例#15
0
        private ManagerPackage CreateManagerPackage(string folder, SceneManager sceneManager, SettingsManager settingsManager, ActionsManager actionsManager, VariablesManager variablesManager, InventoryManager inventoryManager, SpeechManager speechManager, CursorManager cursorManager, MenuManager menuManager)
        {
            ManagerPackage managerPackage = CustomAssetUtility.CreateAsset <ManagerPackage> ("ManagerPackage", folder);

            AssetDatabase.RenameAsset("Assets/" + folder + "/ManagerPackage.asset", folder + "_ManagerPackage");

            managerPackage.sceneManager     = sceneManager;
            managerPackage.settingsManager  = settingsManager;
            managerPackage.actionsManager   = actionsManager;
            managerPackage.variablesManager = variablesManager;

            managerPackage.inventoryManager = inventoryManager;
            managerPackage.speechManager    = speechManager;
            managerPackage.cursorManager    = cursorManager;
            managerPackage.menuManager      = menuManager;

            managerPackage.AssignManagers();
            EditorUtility.SetDirty(managerPackage);
            AssetDatabase.SaveAssets();

            AdventureCreator.Init();

            return(managerPackage);
        }
示例#16
0
		private void OnDestroy ()
		{
			settingsManager = null;
			cursorManager = null;
		}
示例#17
0
        private void Finish()
        {
            if (!references)
            {
                GetReferences();
            }

            if (!references)
            {
                return;
            }

            string managerPath = gameName + "/Managers";

            try
            {
                System.IO.Directory.CreateDirectory(Application.dataPath + "/" + managerPath);
            }
            catch (System.Exception e)
            {
                ACDebug.LogError("Wizard aborted - Could not create directory: " + Application.dataPath + "/" + managerPath + ". Please make sure the Assets direcrory is writeable, and that the intended game name contains no special characters.");
                Debug.LogException(e, this);
                pageNumber--;
                return;
            }

            try
            {
                ShowProgress(0f);

                ScriptableObject t = CustomAssetUtility.CreateAsset <SceneManager> ("SceneManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SceneManager.asset", gameName + "_SceneManager");
                references.sceneManager = (SceneManager)t;

                ShowProgress(0.1f);

                t = CustomAssetUtility.CreateAsset <SettingsManager> ("SettingsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SettingsManager.asset", gameName + "_SettingsManager");
                references.settingsManager = (SettingsManager)t;

                references.settingsManager.saveFileName      = gameName;
                references.settingsManager.cameraPerspective = cameraPerspective;
                references.settingsManager.movingTurning     = movingTurning;
                references.settingsManager.movementMethod    = movementMethod;
                references.settingsManager.inputMethod       = inputMethod;
                references.settingsManager.interactionMethod = interactionMethod;
                references.settingsManager.hotspotDetection  = hotspotDetection;
                if (cameraPerspective == CameraPerspective.TwoPointFiveD)
                {
                    references.settingsManager.forceAspectRatio = true;
                }

                ShowProgress(0.2f);

                t = CustomAssetUtility.CreateAsset <ActionsManager> ("ActionsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/ActionsManager.asset", gameName + "_ActionsManager");
                references.actionsManager = (ActionsManager)t;
                AdventureCreator.RefreshActions();
                ActionsManager defaultActionsManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_ActionsManager.asset", typeof(ActionsManager)) as ActionsManager;
                if (defaultActionsManager != null)
                {
                    references.actionsManager.defaultClass     = defaultActionsManager.defaultClass;
                    references.actionsManager.defaultClassName = defaultActionsManager.defaultClassName;
                }

                ShowProgress(0.3f);

                t = CustomAssetUtility.CreateAsset <VariablesManager> ("VariablesManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/VariablesManager.asset", gameName + "_VariablesManager");
                references.variablesManager = (VariablesManager)t;

                ShowProgress(0.4f);

                t = CustomAssetUtility.CreateAsset <InventoryManager> ("InventoryManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/InventoryManager.asset", gameName + "_InventoryManager");
                references.inventoryManager = (InventoryManager)t;

                ShowProgress(0.5f);

                t = CustomAssetUtility.CreateAsset <SpeechManager> ("SpeechManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SpeechManager.asset", gameName + "_SpeechManager");
                references.speechManager = (SpeechManager)t;
                references.speechManager.ClearLanguages();

                ShowProgress(0.6f);

                t = CustomAssetUtility.CreateAsset <CursorManager> ("CursorManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/CursorManager.asset", gameName + "_CursorManager");
                references.cursorManager = (CursorManager)t;

                ShowProgress(0.7f);

                t = CustomAssetUtility.CreateAsset <MenuManager> ("MenuManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/MenuManager.asset", gameName + "_MenuManager");
                references.menuManager = (MenuManager)t;

                CursorManager defaultCursorManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_CursorManager.asset", typeof(CursorManager)) as CursorManager;
                if (wizardMenu == WizardMenu.Blank)
                {
                    if (defaultCursorManager != null)
                    {
                        CursorIcon useIcon = new CursorIcon();
                        useIcon.Copy(defaultCursorManager.cursorIcons[0], false);
                        references.cursorManager.cursorIcons.Add(useIcon);
                        EditorUtility.SetDirty(references.cursorManager);
                    }
                }
                else
                {
                    if (defaultCursorManager != null)
                    {
                        foreach (CursorIcon defaultIcon in defaultCursorManager.cursorIcons)
                        {
                            CursorIcon newIcon = new CursorIcon();
                            newIcon.Copy(defaultIcon, false);
                            references.cursorManager.cursorIcons.Add(newIcon);
                        }

                        CursorIconBase pointerIcon = new CursorIconBase();
                        pointerIcon.Copy(defaultCursorManager.pointerIcon);
                        references.cursorManager.pointerIcon = pointerIcon;
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot find Default_CursorManager asset to copy from!");
                    }

                    references.cursorManager.allowMainCursor = true;
                    EditorUtility.SetDirty(references.cursorManager);

                    MenuManager defaultMenuManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_MenuManager.asset", typeof(MenuManager)) as MenuManager;
                    if (defaultMenuManager != null)
                    {
                                                #if UNITY_EDITOR
                        references.menuManager.drawOutlines = defaultMenuManager.drawOutlines;
                        references.menuManager.drawInEditor = defaultMenuManager.drawInEditor;
                                                #endif
                        references.menuManager.pauseTexture = defaultMenuManager.pauseTexture;

                        if (wizardMenu != WizardMenu.Blank)
                        {
                            System.IO.Directory.CreateDirectory(Application.dataPath + "/" + gameName + "/UI");
                        }

                        foreach (Menu defaultMenu in defaultMenuManager.menus)
                        {
                            float progress = (float)defaultMenuManager.menus.IndexOf(defaultMenu) / (float)defaultMenuManager.menus.Count;
                            ShowProgress((progress * 0.3f) + 0.7f);

                            Menu newMenu = ScriptableObject.CreateInstance <Menu>();
                            newMenu.Copy(defaultMenu, true, true);
                            newMenu.Recalculate();

                            if (wizardMenu == WizardMenu.DefaultAC)
                            {
                                newMenu.menuSource = MenuSource.AdventureCreator;
                            }
                            else if (wizardMenu == WizardMenu.DefaultUnityUI)
                            {
                                newMenu.menuSource = MenuSource.UnityUiPrefab;
                            }

                            if (defaultMenu.canvas)
                            {
                                string oldPath = AssetDatabase.GetAssetPath(defaultMenu.canvas.gameObject);
                                string newPath = "Assets/" + gameName + "/UI/" + defaultMenu.canvas.name + ".prefab";

                                if (AssetDatabase.CopyAsset(oldPath, newPath))
                                {
                                    AssetDatabase.ImportAsset(newPath);
                                    GameObject canvasObNewPrefab = (GameObject)AssetDatabase.LoadAssetAtPath(newPath, typeof(GameObject));
                                    newMenu.canvas = canvasObNewPrefab.GetComponent <Canvas>();
                                }
                                else
                                {
                                    newMenu.canvas = null;
                                    ACDebug.LogWarning("Could not copy asset " + oldPath + " to " + newPath, defaultMenu.canvas.gameObject);
                                }
                                newMenu.rectTransform = null;
                            }

                            foreach (MenuElement newElement in newMenu.elements)
                            {
                                if (newElement != null)
                                {
                                    AssetDatabase.AddObjectToAsset(newElement, references.menuManager);
                                    newElement.hideFlags = HideFlags.HideInHierarchy;
                                }
                                else
                                {
                                    ACDebug.LogWarning("Null element found in " + newMenu.title + " - the interface may not be set up correctly.");
                                }
                            }

                            if (newMenu != null)
                            {
                                AssetDatabase.AddObjectToAsset(newMenu, references.menuManager);
                                newMenu.hideFlags = HideFlags.HideInHierarchy;

                                references.menuManager.menus.Add(newMenu);
                            }
                            else
                            {
                                ACDebug.LogWarning("Unable to create new Menu from original '" + defaultMenu.title + "'");
                            }
                        }

                        EditorUtility.SetDirty(references.menuManager);

                                                #if CAN_USE_TIMELINE
                        if (references.speechManager != null)
                        {
                            references.speechManager.previewMenuName = "Subtitles";
                            EditorUtility.SetDirty(references.speechManager);
                        }
                                                #endif
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot find Default_MenuManager asset to copy from!");
                    }
                }

                EditorUtility.ClearProgressBar();
                ManagerPackage newManagerPackage = CreateManagerPackage(gameName);

                AssetDatabase.SaveAssets();

                if (newManagerPackage == null || !newManagerPackage.IsFullyAssigned())
                {
                    EditorUtility.DisplayDialog("Wizard failed", "The New Game Wizard failed to generate a new 'Manager Package' file with all eight Managers assigned. Pleae verify that your Assets directory is writable and try again.", "OK");
                }
                else if (GameObject.FindObjectOfType <KickStarter>() == null)
                {
                    bool initScene = EditorUtility.DisplayDialog("Organise scene?", "Process complete.  Would you like to organise the scene objects to begin working?  This can be done at any time within the Scene Manager.", "Yes", "No");
                    if (initScene)
                    {
                        references.sceneManager.InitialiseObjects();
                    }
                }
            }
            catch (System.Exception e)
            {
                ACDebug.LogWarning("Could not create Manager. Does the subdirectory " + managerPath + " exist?");
                Debug.LogException(e, this);
                pageNumber--;
            }
        }
示例#18
0
        /**
         * <summary>Unsets the values of all script variables, so that they can be re-assigned to the correct scene if multiple scenes are open.</summary>
         */
        public void ClearVariables()
        {
            playerPrefab = null;
            mainCameraPrefab = null;
            persistentEnginePrefab = null;
            gameEnginePrefab = null;

            // Managers
            sceneManagerPrefab = null;
            settingsManagerPrefab = null;
            actionsManagerPrefab = null;
            variablesManagerPrefab = null;
            inventoryManagerPrefab = null;
            speechManagerPrefab = null;
            cursorManagerPrefab = null;
            menuManagerPrefab = null;

            // PersistentEngine components
            optionsComponent = null;
            runtimeInventoryComponent = null;
            runtimeVariablesComponent = null;
            playerMenusComponent = null;
            stateHandlerComponent = null;
            sceneChangerComponent = null;
            saveSystemComponent = null;
            levelStorageComponent = null;
            runtimeLanguagesComponent = null;

            // GameEngine components
            menuSystemComponent = null;
            dialogComponent = null;
            playerInputComponent = null;
            playerInteractionComponent = null;
            playerMovementComponent = null;
            playerCursorComponent = null;
            playerQTEComponent = null;
            sceneSettingsComponent = null;
            navigationManagerComponent = null;
            actionListManagerComponent = null;
            localVariablesComponent = null;
            menuPreviewComponent = null;

            SetGameEngine ();
        }
示例#19
0
		private void OnDestroy ()
		{
			actionListManager = null;
			dialog = null;
			playerInput = null;
			playerInteraction = null;
			menuSystem = null;
			stateHandler = null;
			options = null;
			menus = null;
			runtimeInventory = null;
			settingsManager = null;
			cursorManager = null;
			speechManager = null;
			menuManager = null;
			sceneSettings = null;
		}
示例#20
0
        /**
         * Shows the GUI.
         */
        public void ShowGUI()
        {
            if (AdvGame.GetReferences())
            {
                if (AdvGame.GetReferences().settingsManager)
                {
                    settingsManager = AdvGame.GetReferences().settingsManager;
                }
                if (AdvGame.GetReferences().cursorManager)
                {
                    cursorManager = AdvGame.GetReferences().cursorManager;
                }
            }

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

            string label = (items.Count > 0) ? ("Items (" + items.Count + ")") : "Items";

            if (GUILayout.Toggle(showItems, label, "toolbarbutton"))
            {
                SetTab(0);
            }

            label = (bins.Count > 0) ? ("Categories (" + bins.Count + ")") : "Categories";
            if (GUILayout.Toggle(showBins, label, "toolbarbutton"))
            {
                SetTab(1);
            }

            label = (recipes.Count > 0) ? ("Crafting (" + recipes.Count + ")") : "Crafting";
            if (GUILayout.Toggle(showCrafting, label, "toolbarbutton"))
            {
                SetTab(2);
            }

            label = (invVars.Count > 0) ? ("Properties (" + invVars.Count + ")") : "Properties";
            if (GUILayout.Toggle(showProperties, label, "toolbarbutton"))
            {
                SetTab(3);
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.Space();

            if (showBins)
            {
                BinsGUI();
            }
            else if (showCrafting)
            {
                CraftingGUI();
            }
            else if (showItems)
            {
                ItemsGUI();
            }
            else if (showProperties)
            {
                PropertiesGUI();
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(this);
            }
        }
        private void Finish()
        {
            if (!references)
            {
                GetReferences();
            }

            if (!references)
            {
                return;
            }

            string managerPath = gameName + "/Managers";

            try
            {
                System.IO.Directory.CreateDirectory(Application.dataPath + "/" + managerPath);
            }
            catch (System.Exception e)
            {
                ACDebug.LogError("Wizard aborted - Could not create directory: " + Application.dataPath + "/" + managerPath + ". Please make sure the Assets direcrory is writeable, and that the intended game name contains no special characters.");
                Debug.LogException(e, this);
                pageNumber--;
                return;
            }

            try
            {
                ScriptableObject t = CustomAssetUtility.CreateAsset <SceneManager> ("SceneManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SceneManager.asset", gameName + "_SceneManager");
                references.sceneManager = (SceneManager)t;

                t = CustomAssetUtility.CreateAsset <SettingsManager> ("SettingsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SettingsManager.asset", gameName + "_SettingsManager");
                references.settingsManager = (SettingsManager)t;

                references.settingsManager.saveFileName      = gameName;
                references.settingsManager.cameraPerspective = cameraPerspective;
                references.settingsManager.movingTurning     = movingTurning;
                references.settingsManager.movementMethod    = movementMethod;
                references.settingsManager.inputMethod       = inputMethod;
                references.settingsManager.interactionMethod = interactionMethod;
                references.settingsManager.hotspotDetection  = hotspotDetection;
                if (cameraPerspective == CameraPerspective.TwoPointFiveD)
                {
                    references.settingsManager.forceAspectRatio = true;
                }

                t = CustomAssetUtility.CreateAsset <ActionsManager> ("ActionsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/ActionsManager.asset", gameName + "_ActionsManager");
                references.actionsManager = (ActionsManager)t;
                AdventureCreator.RefreshActions();
                ActionsManager defaultActionsManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_ActionsManager.asset", typeof(ActionsManager)) as ActionsManager;
                if (defaultActionsManager != null)
                {
                    references.actionsManager.defaultClass     = defaultActionsManager.defaultClass;
                    references.actionsManager.defaultClassName = defaultActionsManager.defaultClassName;
                }

                t = CustomAssetUtility.CreateAsset <VariablesManager> ("VariablesManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/VariablesManager.asset", gameName + "_VariablesManager");
                references.variablesManager = (VariablesManager)t;

                t = CustomAssetUtility.CreateAsset <InventoryManager> ("InventoryManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/InventoryManager.asset", gameName + "_InventoryManager");
                references.inventoryManager = (InventoryManager)t;

                t = CustomAssetUtility.CreateAsset <SpeechManager> ("SpeechManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SpeechManager.asset", gameName + "_SpeechManager");
                references.speechManager = (SpeechManager)t;

                references.speechManager.ClearLanguages();

                t = CustomAssetUtility.CreateAsset <CursorManager> ("CursorManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/CursorManager.asset", gameName + "_CursorManager");
                references.cursorManager = (CursorManager)t;

                t = CustomAssetUtility.CreateAsset <MenuManager> ("MenuManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/MenuManager.asset", gameName + "_MenuManager");
                references.menuManager = (MenuManager)t;

                CursorManager defaultCursorManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_CursorManager.asset", typeof(CursorManager)) as CursorManager;
                if (wizardMenu == WizardMenu.Blank)
                {
                    if (defaultCursorManager != null)
                    {
                        CursorIcon useIcon = new CursorIcon();
                        useIcon.Copy(defaultCursorManager.cursorIcons[0]);
                        references.cursorManager.cursorIcons.Add(useIcon);
                        EditorUtility.SetDirty(references.cursorManager);
                    }
                }
                else
                {
                    if (defaultCursorManager != null)
                    {
                        foreach (CursorIcon defaultIcon in defaultCursorManager.cursorIcons)
                        {
                            CursorIcon newIcon = new CursorIcon();
                            newIcon.Copy(defaultIcon);
                            references.cursorManager.cursorIcons.Add(newIcon);
                        }

                        CursorIconBase pointerIcon = new CursorIconBase();
                        pointerIcon.Copy(defaultCursorManager.pointerIcon);
                        references.cursorManager.pointerIcon = pointerIcon;
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot find Default_CursorManager asset to copy from!");
                    }
                    references.cursorManager.allowMainCursor = true;
                    EditorUtility.SetDirty(references.cursorManager);

                    MenuManager defaultMenuManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_MenuManager.asset", typeof(MenuManager)) as MenuManager;
                    if (defaultMenuManager != null)
                    {
                                                #if UNITY_EDITOR
                        references.menuManager.drawOutlines = defaultMenuManager.drawOutlines;
                        references.menuManager.drawInEditor = defaultMenuManager.drawInEditor;
                                                #endif
                        references.menuManager.pauseTexture = defaultMenuManager.pauseTexture;

                        if (wizardMenu != WizardMenu.Blank)
                        {
                            System.IO.Directory.CreateDirectory(Application.dataPath + "/" + gameName + "/UI");
                        }
                        foreach (Menu defaultMenu in defaultMenuManager.menus)
                        {
                            Menu newMenu = ScriptableObject.CreateInstance <Menu>();
                            newMenu.Copy(defaultMenu, true, true);
                            newMenu.Recalculate();

                            if (wizardMenu == WizardMenu.DefaultAC)
                            {
                                newMenu.menuSource = MenuSource.AdventureCreator;
                            }
                            else if (wizardMenu == WizardMenu.DefaultUnityUI)
                            {
                                newMenu.menuSource = MenuSource.UnityUiPrefab;
                            }

                            if (defaultMenu.canvas)
                            {
                                string newCanvasPath = "Assets/" + gameName + "/UI/" + defaultMenu.canvas.name + ".prefab";

                                GameObject canvasObInScene = (GameObject)PrefabUtility.InstantiatePrefab(defaultMenu.canvas.gameObject);
                                PrefabUtility.DisconnectPrefabInstance(canvasObInScene);
                                GameObject canvasObNewPrefab = PrefabUtility.CreatePrefab(newCanvasPath, canvasObInScene);

                                newMenu.canvas = canvasObNewPrefab.GetComponent <Canvas>();
                                DestroyImmediate(canvasObInScene);

                                newMenu.rectTransform = null;
                            }

                            foreach (MenuElement newElement in newMenu.elements)
                            {
                                AssetDatabase.AddObjectToAsset(newElement, references.menuManager);
                                newElement.hideFlags = HideFlags.HideInHierarchy;
                            }
                            AssetDatabase.AddObjectToAsset(newMenu, references.menuManager);
                            newMenu.hideFlags = HideFlags.HideInHierarchy;

                            references.menuManager.menus.Add(newMenu);
                        }

                        EditorUtility.SetDirty(references.menuManager);
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot find Default_MenuManager asset to copy from!");
                    }
                }

                CreateManagerPackage(gameName);

                AssetDatabase.SaveAssets();
                if (GameObject.FindObjectOfType <KickStarter>() == null)
                {
                    bool initScene = EditorUtility.DisplayDialog("Setup scene?", "Process complete.  Would you like to organise the scene objects to begin working?  This can be done at any time within the Scene Manager.", "Yes", "No");
                    if (initScene)
                    {
                        references.sceneManager.InitialiseObjects();
                    }
                }
            }
            catch (System.Exception e)
            {
                ACDebug.LogWarning("Could not create Manager. Does the subdirectory " + managerPath + " exist?");
                Debug.LogException(e, this);
                pageNumber--;
            }
        }
示例#22
0
        /**
         * Shows the GUI.
         */
        public void ShowGUI()
        {
            if (!sideIcon)
            {
                sideIcon = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Graphics/Textures/inspector-use.png", typeof(Texture2D));
            }

            if (AdvGame.GetReferences())
            {
                if (AdvGame.GetReferences().settingsManager)
                {
                    settingsManager = AdvGame.GetReferences().settingsManager;
                }
                if (AdvGame.GetReferences().cursorManager)
                {
                    cursorManager = AdvGame.GetReferences().cursorManager;
                }
            }

            EditorGUILayout.Space();
            GUILayout.BeginHorizontal();
            if (GUILayout.Toggle(showItems, "Items", "toolbarbutton"))
            {
                SetTab(0);
            }
            if (GUILayout.Toggle(showBins, "Categories", "toolbarbutton"))
            {
                SetTab(1);
            }
            if (GUILayout.Toggle(showCrafting, "Crafting", "toolbarbutton"))
            {
                SetTab(2);
            }
            if (GUILayout.Toggle(showProperties, "Properties", "toolbarbutton"))
            {
                SetTab(3);
            }
            GUILayout.EndHorizontal();
            EditorGUILayout.Space();

            if (showBins)
            {
                BinsGUI();
            }
            else if (showCrafting)
            {
                CraftingGUI();
            }
            else if (showItems)
            {
                ItemsGUI();
            }
            else if (showProperties)
            {
                PropertiesGUI();
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(this);
            }
        }
示例#23
0
        protected bool TestManagerPresence()
        {
            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;
                CursorManager    cursorManager    = AdvGame.GetReferences().cursorManager;
                MenuManager      menuManager      = AdvGame.GetReferences().menuManager;

                string missingManagers = string.Empty;
                if (sceneManager == null)
                {
                    if (!string.IsNullOrEmpty(missingManagers))
                    {
                        missingManagers += ", ";
                    }
                    missingManagers += "Scene";
                }
                if (settingsManager == null)
                {
                    if (!string.IsNullOrEmpty(missingManagers))
                    {
                        missingManagers += ", ";
                    }
                    missingManagers += "Settings";
                }
                if (actionsManager == null)
                {
                    if (!string.IsNullOrEmpty(missingManagers))
                    {
                        missingManagers += ", ";
                    }
                    missingManagers += "Actions";
                }
                if (variablesManager == null)
                {
                    if (!string.IsNullOrEmpty(missingManagers))
                    {
                        missingManagers += ", ";
                    }
                    missingManagers += "Variables";
                }
                if (inventoryManager == null)
                {
                    if (!string.IsNullOrEmpty(missingManagers))
                    {
                        missingManagers += ", ";
                    }
                    missingManagers += "Inventory";
                }
                if (speechManager == null)
                {
                    if (!string.IsNullOrEmpty(missingManagers))
                    {
                        missingManagers += ", ";
                    }
                    missingManagers += "Speech";
                }
                if (cursorManager == null)
                {
                    if (!string.IsNullOrEmpty(missingManagers))
                    {
                        missingManagers += ", ";
                    }
                    missingManagers += "Cursor";
                }
                if (menuManager == null)
                {
                    if (!string.IsNullOrEmpty(missingManagers))
                    {
                        missingManagers += ", ";
                    }
                    missingManagers += "Menu";
                }

                if (!string.IsNullOrEmpty(missingManagers))
                {
                    ACDebug.LogError("Unassigned AC Manager(s): " + missingManagers + " - all Managers must be assigned in the AC Game Editor window for AC to initialise");
                    return(false);
                }
            }
            else
            {
                ACDebug.LogError("No References object found. Please set one using the main Adventure Creator window");
                return(false);
            }

            return(true);
        }
示例#24
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 (AdvGame.GetReferences ().inventoryManager)
				{
					inventoryManager = AdvGame.GetReferences ().inventoryManager;
				}
				if (AdvGame.GetReferences ().cursorManager)
				{
					cursorManager = AdvGame.GetReferences ().cursorManager;
				}
				if (AdvGame.GetReferences ().settingsManager)
				{
					settingsManager = AdvGame.GetReferences ().settingsManager;
				}
				
				if (_target.lineID > -1)
				{
					EditorGUILayout.LabelField ("Speech Manager ID:", _target.lineID.ToString ());
				}
				
				_target.interactionSource = (InteractionSource) EditorGUILayout.EnumPopup ("Interaction source:", _target.interactionSource);
				_target.hotspotName = EditorGUILayout.TextField ("Label (if not name):", _target.hotspotName);
				_target.highlight = (Highlight) EditorGUILayout.ObjectField ("Object to highlight:", _target.highlight, typeof (Highlight), true);

				EditorGUILayout.BeginHorizontal ();
				_target.walkToMarker = (Marker) EditorGUILayout.ObjectField ("Walk-to marker:", _target.walkToMarker, typeof (Marker), true);

				if (_target.walkToMarker == null)
				{
					if (GUILayout.Button ("Auto-create", autoWidth))
					{
						string prefabName = "Marker";
						if (settingsManager && settingsManager.IsUnity2D ())
						{
							prefabName += "2D";
						}
						Marker newMarker = AdvGame.GetReferences ().sceneManager.AddPrefab ("Navigation", prefabName, true, false, true).GetComponent <Marker>();
						newMarker.gameObject.name += (": " + _target.gameObject.name);
						newMarker.transform.position = _target.transform.position;
						_target.walkToMarker = newMarker;
					}
				}
				EditorGUILayout.EndHorizontal ();

				_target.drawGizmos = EditorGUILayout.Toggle ("Draw yellow cube?", _target.drawGizmos);
				
				if (settingsManager != null && settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive)
				{
					_target.oneClick = EditorGUILayout.Toggle ("Single 'Use' Interaction?", _target.oneClick);
				}
				EditorGUILayout.Space ();
				
				UseInteractionGUI ();
				
				if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive)
				{
					EditorGUILayout.Space ();
					LookInteractionGUI ();
				}
				
				EditorGUILayout.Space ();
				InvInteractionGUI ();
			}
			
			if (GUI.changed)
			{
				EditorUtility.SetDirty (_target);
			}
		}
示例#25
0
        public void ShowGUI(string apiPrefix, List <string> binList)
        {
            Upgrade();

            label    = CustomGUILayout.TextField("Name:", label, apiPrefix + ".label", "The item's Editor name");
            altLabel = CustomGUILayout.TextField("Label (if not name):", altLabel, apiPrefix + ".altLabel", "The item's in-game name, if not label");

            bool isPronoun = !canBeLowerCase;

            isPronoun      = CustomGUILayout.Toggle("Name is pronoun?", isPronoun, "!" + apiPrefix + ".canBeLowerCase", "If False, the name will be lower-cased when inside sentences.");
            canBeLowerCase = !isPronoun;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Category:", "The category that the item belongs to"), GUILayout.Width(146f));
            if (KickStarter.inventoryManager.bins.Count > 0)
            {
                int binNumber = KickStarter.inventoryManager.GetBinSlot(binID);
                binNumber = CustomGUILayout.Popup(binNumber, binList.ToArray(), apiPrefix + ".binID");
                binID     = KickStarter.inventoryManager.bins[binNumber].id;
            }
            else
            {
                binID = -1;
                EditorGUILayout.LabelField("No categories defined!", EditorStyles.miniLabel, GUILayout.Width(146f));
            }
            EditorGUILayout.EndHorizontal();

            carryOnStart = CustomGUILayout.Toggle("Carry on start?", carryOnStart, apiPrefix + ".carryOnStart", "If True, the Player carries the item when the game begins");
            if (carryOnStart && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.playerSwitching == PlayerSwitching.Allow && !AdvGame.GetReferences().settingsManager.shareInventory)
            {
                carryOnStartNotDefault = CustomGUILayout.Toggle("Non-default Player(s)?", carryOnStartNotDefault, apiPrefix + ".carryOnStartNotDefault", "If True, then a Player prefab that is not the default carries the item when the game begins");
                if (carryOnStartNotDefault)
                {
                    carryOnStartIDs = ChoosePlayerGUI(carryOnStartIDs, apiPrefix + ".carryOnStartID");
                }
            }

            canCarryMultiple = CustomGUILayout.Toggle("Can carry multiple?", canCarryMultiple, apiPrefix + ".canCarryMultiple", "If True, then multiple instances of the item can be carried at once");

            if (carryOnStart && canCarryMultiple)
            {
                count = CustomGUILayout.IntField("Quantity on start:", count, apiPrefix + ".count", "The number of instances that the player is carrying when the game begins");
            }
            else
            {
                count = 1;
            }

            if (canCarryMultiple)
            {
                if (maxCount == 0)
                {
                    maxCount = 999;
                }
                maxCount = CustomGUILayout.IntField("Slot capacity:", maxCount, apiPrefix + ".maxCount", "The number of instances of the item that can occupy a single inventory slot");
                if (maxCount < 1)
                {
                    maxCount = 1;
                }

                if (maxCount > 1)
                {
                    itemStackingMode = (ItemStackingMode)CustomGUILayout.EnumPopup("Selection mode:", itemStackingMode, apiPrefix + ".itemStackingMode", "How to select items when multiple are in a given slot");
                }
            }

            overrideUseSyntax = CustomGUILayout.Toggle("Override 'Use' syntax?", overrideUseSyntax, apiPrefix + ".overrideUseSyntax", "If True, then the item has its own 'Use X on Y' syntax when selected");
            if (overrideUseSyntax)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Use syntax:", GUILayout.Width(100f));
                hotspotPrefix1.label = EditorGUILayout.TextField(hotspotPrefix1.label, GUILayout.MaxWidth(80f));
                EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f));
                hotspotPrefix2.label = EditorGUILayout.TextField(hotspotPrefix2.label, GUILayout.MaxWidth(80f));
                EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f));
                EditorGUILayout.EndHorizontal();
            }

            linkedPrefab = (GameObject)CustomGUILayout.ObjectField <GameObject> ("Linked prefab:", linkedPrefab, false, apiPrefix + ".linkedPrefab", "A GameObject that can be associated with the item, for the creation of e.g. 3D inventory items (through scripting only)");
            if (linkedPrefab != null)
            {
                EditorGUILayout.HelpBox("This reference is accessible through scripting, or via Inventory parameter in the 'Object: Add or remove' Action.", MessageType.Info);
            }

            CustomGUILayout.DrawUILine();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Main graphic:", "The item's main graphic"), GUILayout.Width(145));
            tex = (Texture)CustomGUILayout.ObjectField <Texture> (tex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".tex");
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Active graphic:", "The item's 'highlighted' graphic"), GUILayout.Width(145));
            activeTex = (Texture)CustomGUILayout.ObjectField <Texture> (activeTex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".activeTex");
            EditorGUILayout.EndHorizontal();

            if (AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.selectInventoryDisplay == SelectInventoryDisplay.ShowSelectedGraphic)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("Selected graphic:", "The item's 'selected' graphic"), GUILayout.Width(145));
                selectedTex = (Texture)CustomGUILayout.ObjectField <Texture> (selectedTex, false, GUILayout.Width(70), GUILayout.Height(70), apiPrefix + ".selectedTex");
                EditorGUILayout.EndHorizontal();
            }
            if (AdvGame.GetReferences().cursorManager != null)
            {
                CursorManager cursorManager = AdvGame.GetReferences().cursorManager;
                if (cursorManager.inventoryHandling == InventoryHandling.ChangeCursor || cursorManager.inventoryHandling == InventoryHandling.ChangeCursorAndHotspotLabel)
                {
                    cursorIcon.ShowGUI(true, true, "Cursor (optional):", cursorManager.cursorRendering, apiPrefix + ".cursorIcon", "A Cursor that, if assigned, will be used in place of the 'tex' Texture when the item is selected on the cursor");
                    CustomGUILayout.DrawUILine();
                }
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Standard interactions", CustomStyles.subHeader);
            if (KickStarter.settingsManager && KickStarter.settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple && KickStarter.cursorManager)
            {
                List <string> iconList = new List <string> ();
                foreach (CursorIcon icon in KickStarter.cursorManager.cursorIcons)
                {
                    iconList.Add(icon.id.ToString() + ": " + icon.label);
                }

                if (KickStarter.cursorManager.cursorIcons.Count > 0)
                {
                    foreach (InvInteraction interaction in interactions)
                    {
                        EditorGUILayout.BeginHorizontal();
                        int invNumber = GetIconSlot(interaction.icon.id);
                        invNumber        = EditorGUILayout.Popup(invNumber, iconList.ToArray());
                        interaction.icon = KickStarter.cursorManager.cursorIcons[invNumber];

                        int    i        = interactions.IndexOf(interaction);
                        string autoName = label + "_" + interaction.icon.label;
                        interaction.actionList = ActionListAssetMenu.AssetGUI("", interaction.actionList, autoName, apiPrefix + ".interactions[" + i + "].actionList", "The ActionList to run when the interaction is triggered");

                        if (GUILayout.Button(string.Empty, CustomStyles.IconCog))
                        {
                            SideInteractionMenu(interactions.IndexOf(interaction));
                        }

                        EditorGUILayout.EndHorizontal();
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No interaction icons defined - please use the Cursor Manager", MessageType.Warning);
                }
                if (GUILayout.Button("Add interaction"))
                {
                    Undo.RecordObject(KickStarter.inventoryManager, "Add new interaction");
                    interactions.Add(new InvInteraction(KickStarter.cursorManager.cursorIcons[0]));
                }
            }
            else
            {
                string autoName = label + "_Use";
                useActionList = ActionListAssetMenu.AssetGUI("Use:", useActionList, autoName, apiPrefix + ".useActionList", "The ActionList asset to run when using the item is used");
                if (KickStarter.cursorManager && KickStarter.cursorManager.allowInteractionCursorForInventory && KickStarter.cursorManager.cursorIcons.Count > 0)
                {
                    int useCursor_int = KickStarter.cursorManager.GetIntFromID(useIconID) + 1;
                    if (useIconID == -1)
                    {
                        useCursor_int = 0;
                    }
                    useCursor_int = CustomGUILayout.Popup("Use cursor icon:", useCursor_int, KickStarter.cursorManager.GetLabelsArray(true), apiPrefix + ".useIconID", "The Cursor to show when hovering over the item");

                    if (useCursor_int == 0)
                    {
                        useIconID = -1;
                    }
                    else if (KickStarter.cursorManager.cursorIcons.Count > (useCursor_int - 1))
                    {
                        useIconID = KickStarter.cursorManager.cursorIcons[useCursor_int - 1].id;
                    }
                }
                else
                {
                    useIconID = 0;
                }
                autoName       = label + "_Examine";
                lookActionList = ActionListAssetMenu.AssetGUI("Examine:", lookActionList, autoName, apiPrefix + ".lookActionList", "The ActionListAsset to run when the item is examined");
            }

            if (KickStarter.settingsManager && KickStarter.settingsManager.CanSelectItems(false))
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Unhandled interactions", CustomStyles.subHeader);
                string autoName = label + "_Unhandled_Hotspot";
                unhandledActionList        = ActionListAssetMenu.AssetGUI("Unhandled use on Hotspot:", unhandledActionList, autoName, apiPrefix + ".unhandledActionList", "The ActionList asset to run when using the item on a Hotspot is unhandled");
                autoName                   = label + "_Unhandled_Combine";
                unhandledCombineActionList = ActionListAssetMenu.AssetGUI("Unhandled combine:", unhandledCombineActionList, autoName, apiPrefix + ".unhandledCombineActionList", "The ActionListAsset to run when using the item on another InvItem is unhandled");
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Combine interactions", CustomStyles.subHeader);
            for (int i = 0; i < combineActionList.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();
                int invNumber = KickStarter.inventoryManager.GetArraySlot(combineID[i]);
                invNumber    = EditorGUILayout.Popup(invNumber, KickStarter.inventoryManager.GetLabelList());
                combineID[i] = KickStarter.inventoryManager.items[invNumber].id;

                string autoName = label + "_Combine_" + KickStarter.inventoryManager.GetLabelList()[invNumber];
                combineActionList[i] = ActionListAssetMenu.AssetGUI(string.Empty, combineActionList[i], autoName, apiPrefix + ".combineActionList[" + i + "]", "A List of all 'Combine' InvInteraction objects associated with the item");

                if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                {
                    Undo.RecordObject(KickStarter.inventoryManager, "Delete combine event");
                    combineActionList.RemoveAt(i);
                    combineID.RemoveAt(i);
                    break;
                }
                EditorGUILayout.EndHorizontal();
            }
            if (GUILayout.Button("Add combine event"))
            {
                Undo.RecordObject(KickStarter.inventoryManager, "Add new combine event");
                combineActionList.Add(null);
                combineID.Add(0);
            }

            // List all "reverse" inventory combinations
            string reverseCombinations = string.Empty;

            foreach (InvItem otherItem in KickStarter.inventoryManager.items)
            {
                if (otherItem != this)
                {
                    if (otherItem.combineID.Contains(id))
                    {
                        reverseCombinations += "- " + otherItem.label + "\n";
                        continue;
                    }
                }
            }
            if (reverseCombinations.Length > 0)
            {
                EditorGUILayout.Space();
                EditorGUILayout.HelpBox("The following inventory items have combine interactions that reference this item:\n" + reverseCombinations, MessageType.Info);
            }

            if (KickStarter.inventoryManager.invVars.Count > 0)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Properties", CustomStyles.subHeader);

                RebuildProperties();

                // UI for setting property values
                if (vars.Count > 0)
                {
                    foreach (InvVar invVar in vars)
                    {
                        invVar.ShowGUI(apiPrefix + ".GetProperty (" + invVar.id + ")");
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No properties have been defined that this inventory item can use.", MessageType.Info);
                }
            }
        }
示例#26
0
        /**
         * Shows the GUI.
         */
        public void ShowGUI()
        {
            if (!sideIcon)
            {
                sideIcon = (Texture2D) AssetDatabase.LoadAssetAtPath ("Assets/AdventureCreator/Graphics/Textures/inspector-use.png", typeof (Texture2D));
            }

            if (AdvGame.GetReferences ())
            {
                if (AdvGame.GetReferences ().settingsManager)
                {
                    settingsManager = AdvGame.GetReferences ().settingsManager;
                }
                if (AdvGame.GetReferences ().cursorManager)
                {
                    cursorManager = AdvGame.GetReferences ().cursorManager;
                }
            }

            EditorGUILayout.Space ();
            GUILayout.BeginHorizontal ();
            if (GUILayout.Toggle (showItems, "Items", "toolbarbutton"))
            {
                SetTab (0);
            }
            if (GUILayout.Toggle (showBins, "Categories", "toolbarbutton"))
            {
                SetTab (1);
            }
            if (GUILayout.Toggle (showCrafting, "Crafting", "toolbarbutton"))
            {
                SetTab (2);
            }
            GUILayout.EndHorizontal ();
            EditorGUILayout.Space ();

            if (showBins)
            {
                BinsGUI ();
            }
            else if (showCrafting)
            {
                CraftingGUI ();
            }
            else if (showItems)
            {
                ItemsGUI ();
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty (this);
            }
        }
示例#27
0
        private void ItemsGUI()
        {
            EditorGUILayout.LabelField("Unhandled events", EditorStyles.boldLabel);
            unhandledCombine = ActionListAssetMenu.AssetGUI("Combine:", unhandledCombine);
            unhandledHotspot = ActionListAssetMenu.AssetGUI("Use on hotspot:", unhandledHotspot);
            if (settingsManager != null && settingsManager.CanGiveItems())
            {
                unhandledGive = ActionListAssetMenu.AssetGUI("Give to NPC:", unhandledGive);
            }

            List <string> binList = new List <string>();

            foreach (InvBin bin in bins)
            {
                binList.Add(bin.label);
            }

            EditorGUILayout.Space();
            CreateItemsGUI(binList.ToArray());
            EditorGUILayout.Space();

            if (selectedItem != null && items.Contains(selectedItem))
            {
                EditorGUILayout.LabelField("Inventory item '" + selectedItem.label + "' properties", EditorStyles.boldLabel);

                EditorGUILayout.BeginVertical("Button");
                selectedItem.label    = EditorGUILayout.TextField("Name:", selectedItem.label);
                selectedItem.altLabel = EditorGUILayout.TextField("Label (if not name):", selectedItem.altLabel);

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Category:", GUILayout.Width(146f));
                if (bins.Count > 0)
                {
                    binNumber          = GetBinSlot(selectedItem.binID);
                    binNumber          = EditorGUILayout.Popup(binNumber, binList.ToArray());
                    selectedItem.binID = bins[binNumber].id;
                }
                else
                {
                    selectedItem.binID = -1;
                    EditorGUILayout.LabelField("No categories defined!", EditorStyles.miniLabel, GUILayout.Width(146f));
                }
                EditorGUILayout.EndHorizontal();

                selectedItem.tex = (Texture2D)EditorGUILayout.ObjectField("Texture:", selectedItem.tex, typeof(Texture2D), false);

                if (settingsManager && (settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive || settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot || (settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction && settingsManager.inventoryInteractions == InventoryInteractions.Single)))
                {
                    selectedItem.activeTex = (Texture2D)EditorGUILayout.ObjectField("Active texture:", selectedItem.activeTex, typeof(Texture2D), false);
                }

                selectedItem.carryOnStart = EditorGUILayout.Toggle("Carry on start?", selectedItem.carryOnStart);
                if (selectedItem.carryOnStart && AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.playerSwitching == PlayerSwitching.Allow && !AdvGame.GetReferences().settingsManager.shareInventory)
                {
                    selectedItem.carryOnStartNotDefault = EditorGUILayout.Toggle("Give to non-default player?", selectedItem.carryOnStartNotDefault);
                    if (selectedItem.carryOnStartNotDefault)
                    {
                        selectedItem.carryOnStartID = ChoosePlayerGUI(selectedItem.carryOnStartID);
                    }
                }

                selectedItem.canCarryMultiple = EditorGUILayout.Toggle("Can carry multiple?", selectedItem.canCarryMultiple);
                if (selectedItem.canCarryMultiple)
                {
                    selectedItem.useSeparateSlots = EditorGUILayout.Toggle("Place in separate slots?", selectedItem.useSeparateSlots);
                }
                if (selectedItem.carryOnStart && selectedItem.canCarryMultiple)
                {
                    selectedItem.count = EditorGUILayout.IntField("Quantity on start:", selectedItem.count);
                }
                else
                {
                    selectedItem.count = 1;
                }

                selectedItem.overrideUseSyntax = EditorGUILayout.Toggle("Override 'Use' syntax?", selectedItem.overrideUseSyntax);
                if (selectedItem.overrideUseSyntax)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Use syntax:", GUILayout.Width(100f));
                    selectedItem.hotspotPrefix1.label = EditorGUILayout.TextField(selectedItem.hotspotPrefix1.label, GUILayout.MaxWidth(80f));
                    EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f));
                    selectedItem.hotspotPrefix2.label = EditorGUILayout.TextField(selectedItem.hotspotPrefix2.label, GUILayout.MaxWidth(80f));
                    EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f));
                    EditorGUILayout.EndHorizontal();
                }

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Standard interactions", EditorStyles.boldLabel);
                if (settingsManager && settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && settingsManager.inventoryInteractions == InventoryInteractions.Multiple && AdvGame.GetReferences().cursorManager)
                {
                    CursorManager cursorManager = AdvGame.GetReferences().cursorManager;

                    List <string> iconList = new List <string>();
                    foreach (CursorIcon icon in cursorManager.cursorIcons)
                    {
                        iconList.Add(icon.label);
                    }

                    if (cursorManager.cursorIcons.Count > 0)
                    {
                        foreach (InvInteraction interaction in selectedItem.interactions)
                        {
                            EditorGUILayout.BeginHorizontal();
                            invNumber        = GetIconSlot(interaction.icon.id);
                            invNumber        = EditorGUILayout.Popup(invNumber, iconList.ToArray());
                            interaction.icon = cursorManager.cursorIcons[invNumber];

                            interaction.actionList = ActionListAssetMenu.AssetGUI("", interaction.actionList);

                            if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                            {
                                Undo.RecordObject(this, "Delete interaction");
                                selectedItem.interactions.Remove(interaction);
                                break;
                            }
                            EditorGUILayout.EndHorizontal();
                        }
                    }
                    else
                    {
                        EditorGUILayout.HelpBox("No interaction icons defined - please use the Cursor Manager", MessageType.Warning);
                    }
                    if (GUILayout.Button("Add interaction"))
                    {
                        Undo.RecordObject(this, "Add new interaction");
                        selectedItem.interactions.Add(new InvInteraction(cursorManager.cursorIcons[0]));
                    }
                }
                else
                {
                    selectedItem.useActionList = ActionListAssetMenu.AssetGUI("Use:", selectedItem.useActionList);
                    if (cursorManager && cursorManager.allowInteractionCursorForInventory && cursorManager.cursorIcons.Count > 0)
                    {
                        int useCursor_int = cursorManager.GetIntFromID(selectedItem.useIconID);
                        useCursor_int          = EditorGUILayout.Popup("Use cursor icon:", useCursor_int, cursorManager.GetLabelsArray(useCursor_int));
                        selectedItem.useIconID = cursorManager.cursorIcons[useCursor_int].id;
                    }
                    else
                    {
                        selectedItem.useIconID = 0;
                    }
                    selectedItem.lookActionList = ActionListAssetMenu.AssetGUI("Examine:", selectedItem.lookActionList);
                }

                if (settingsManager.CanSelectItems(false))
                {
                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Unhandled interactions", EditorStyles.boldLabel);
                    selectedItem.unhandledActionList        = ActionListAssetMenu.AssetGUI("Unhandled use on Hotspot:", selectedItem.unhandledActionList);
                    selectedItem.unhandledCombineActionList = ActionListAssetMenu.AssetGUI("Unhandled combine:", selectedItem.unhandledCombineActionList);
                }

                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Combine interactions", EditorStyles.boldLabel);
                for (int i = 0; i < selectedItem.combineActionList.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();
                    invNumber = GetArraySlot(selectedItem.combineID[i]);
                    invNumber = EditorGUILayout.Popup(invNumber, GetLabelList());
                    selectedItem.combineID[i] = items[invNumber].id;

                    selectedItem.combineActionList[i] = ActionListAssetMenu.AssetGUI("", selectedItem.combineActionList[i]);

                    if (GUILayout.Button(deleteContent, EditorStyles.miniButtonRight, buttonWidth))
                    {
                        Undo.RecordObject(this, "Delete combine event");
                        selectedItem.combineActionList.RemoveAt(i);
                        selectedItem.combineID.RemoveAt(i);
                        break;
                    }
                    EditorGUILayout.EndHorizontal();
                }
                if (GUILayout.Button("Add combine event"))
                {
                    Undo.RecordObject(this, "Add new combine event");
                    selectedItem.combineActionList.Add(null);
                    selectedItem.combineID.Add(0);
                }

                EditorGUILayout.EndVertical();
            }
        }
示例#28
0
        private void Finish()
        {
            if (!references)
            {
                GetReferences();
            }

            if (!references)
            {
                return;
            }

            string managerPath = gameName + "/Managers";

            try
            {
                System.IO.Directory.CreateDirectory(Application.dataPath + "/" + managerPath);
            }
            catch
            {
                Debug.LogWarning("Could not create directory: " + Application.dataPath + "/" + managerPath);
                pageNumber--;
                return;
            }

            try
            {
                ScriptableObject t = CustomAssetUtility.CreateAsset <SceneManager> ("SceneManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SceneManager.asset", gameName + "_SceneManager");
                references.sceneManager = (SceneManager)t;

                t = CustomAssetUtility.CreateAsset <SettingsManager> ("SettingsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SettingsManager.asset", gameName + "_SettingsManager");
                references.settingsManager = (SettingsManager)t;

                references.settingsManager.saveFileName      = gameName;
                references.settingsManager.cameraPerspective = cameraPerspective;
                references.settingsManager.movementMethod    = movementMethod;
                references.settingsManager.inputMethod       = inputMethod;
                references.settingsManager.interactionMethod = interactionMethod;
                references.settingsManager.hotspotDetection  = hotspotDetection;
                references.settingsManager.movingTurning     = movingTurning;
                if (cameraPerspective == CameraPerspective.TwoPointFiveD)
                {
                    references.settingsManager.forceAspectRatio = true;
                }

                t = CustomAssetUtility.CreateAsset <ActionsManager> ("ActionsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/ActionsManager.asset", gameName + "_ActionsManager");
                references.actionsManager = (ActionsManager)t;
                AdventureCreator.RefreshActions();
                ActionsManager demoActionsManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_ActionsManager.asset", typeof(ActionsManager)) as ActionsManager;
                if (demoActionsManager != null)
                {
                    references.actionsManager.defaultClass = demoActionsManager.defaultClass;
                }

                t = CustomAssetUtility.CreateAsset <VariablesManager> ("VariablesManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/VariablesManager.asset", gameName + "_VariablesManager");
                references.variablesManager = (VariablesManager)t;

                t = CustomAssetUtility.CreateAsset <InventoryManager> ("InventoryManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/InventoryManager.asset", gameName + "_InventoryManager");
                references.inventoryManager = (InventoryManager)t;

                t = CustomAssetUtility.CreateAsset <SpeechManager> ("SpeechManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SpeechManager.asset", gameName + "_SpeechManager");
                references.speechManager = (SpeechManager)t;

                references.speechManager.ClearLanguages();

                t = CustomAssetUtility.CreateAsset <CursorManager> ("CursorManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/CursorManager.asset", gameName + "_CursorManager");
                references.cursorManager = (CursorManager)t;

                t = CustomAssetUtility.CreateAsset <MenuManager> ("MenuManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/MenuManager.asset", gameName + "_MenuManager");
                references.menuManager = (MenuManager)t;

                if (wizardMenu != WizardMenu.Blank)
                {
                    CursorManager demoCursorManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_CursorManager.asset", typeof(CursorManager)) as CursorManager;
                    if (demoCursorManager != null)
                    {
                        foreach (CursorIcon demoIcon in demoCursorManager.cursorIcons)
                        {
                            CursorIcon newIcon = new CursorIcon();
                            newIcon.Copy(demoIcon);
                            references.cursorManager.cursorIcons.Add(newIcon);
                        }
                    }
                    else
                    {
                        Debug.LogWarning("Cannot find Demo_CursorManager asset to copy from!");
                    }
                    references.cursorManager.allowMainCursor = true;

                    CursorIconBase pointerIcon = new CursorIconBase();
                    pointerIcon.Copy(demoCursorManager.pointerIcon);
                    references.cursorManager.pointerIcon = pointerIcon;
                    EditorUtility.SetDirty(references.cursorManager);

                    MenuManager demoMenuManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_MenuManager.asset", typeof(MenuManager)) as MenuManager;
                    if (demoMenuManager != null)
                    {
                        references.menuManager.drawOutlines = demoMenuManager.drawOutlines;
                        references.menuManager.drawInEditor = demoMenuManager.drawInEditor;
                        references.menuManager.pauseTexture = demoMenuManager.pauseTexture;

                        if (wizardMenu == WizardMenu.DefaultUnityUI)
                        {
                            System.IO.Directory.CreateDirectory(Application.dataPath + "/" + gameName + "/UI");
                        }

                        foreach (Menu demoMenu in demoMenuManager.menus)
                        {
                            Menu newMenu = ScriptableObject.CreateInstance <Menu>();
                            newMenu.Copy(demoMenu);

                            if (wizardMenu == WizardMenu.DefaultAC)
                            {
                                newMenu.menuSource = MenuSource.AdventureCreator;
                            }
                            else if (wizardMenu == WizardMenu.DefaultUnityUI)
                            {
                                newMenu.menuSource = MenuSource.UnityUiPrefab;

                                if (demoMenu.canvas)
                                {
                                    string oldCanvasPath = AssetDatabase.GetAssetPath(demoMenu.canvas);
                                    string newCanvasPath = "Assets/" + gameName + "/UI/" + demoMenu.canvas.name + ".prefab";
                                    if (AssetDatabase.CopyAsset(oldCanvasPath, newCanvasPath))
                                    {
                                        AssetDatabase.ImportAsset(newCanvasPath);
                                        newMenu.canvas = (Canvas)AssetDatabase.LoadAssetAtPath(newCanvasPath, typeof(Canvas));
                                    }
                                }
                            }

                            newMenu.hideFlags = HideFlags.HideInHierarchy;
                            references.menuManager.menus.Add(newMenu);
                            EditorUtility.SetDirty(references.menuManager);
                            foreach (MenuElement newElement in newMenu.elements)
                            {
                                newElement.hideFlags = HideFlags.HideInHierarchy;
                                AssetDatabase.AddObjectToAsset(newElement, references.menuManager);
                            }
                            AssetDatabase.AddObjectToAsset(newMenu, references.menuManager);
                        }
                    }
                    else
                    {
                        Debug.LogWarning("Cannot find Demo_MenuManager asset to copy from!");
                    }
                }

                CreateManagerPackage(gameName);

                AssetDatabase.SaveAssets();
                references.sceneManager.InitialiseObjects();
                pageNumber = 0;
            }
            catch
            {
                Debug.LogWarning("Could not create Manager. Does the subdirectory " + Resource.managersDirectory + " exist?");
                pageNumber--;
            }
        }
示例#29
0
 private int GetIconID(string label, int iconID, CursorManager cursorManager)
 {
     int iconInt = cursorManager.GetIntFromID (iconID);
     iconInt = EditorGUILayout.Popup (label, iconInt, cursorManager.GetLabelsArray (iconInt));
     iconID = cursorManager.cursorIcons[iconInt].id;
     return iconID;
 }
        private void ShowPage()
        {
            GUI.skin.label.wordWrap = true;

            if (pageNumber == 0)
            {
                if (Resource.ACLogo)
                {
                    GUI.DrawTexture(new Rect(82, 25, 256, 128), Resource.ACLogo);
                }
                GUILayout.Space(140f);
                GUILayout.Label("New Game Wizard", CustomStyles.managerHeader);

                GUILayout.Space(5f);
                GUILayout.Label("This window can help you get started with making a new Adventure Creator game.");
                GUILayout.Label("To begin, click 'Next'. Changes will not be implemented until you are finished.");
            }

            else if (pageNumber == 1)
            {
                GUILayout.Label("Enter a name for your game. This will be used for filenames, so alphanumeric characters only.");
                gameName = GUILayout.TextField(gameName);
            }

            else if (pageNumber == 2)
            {
                GUILayout.Label("What kind of perspective will your game have?");
                cameraPerspective_int = EditorGUILayout.Popup(cameraPerspective_int, cameraPerspective_list);

                if (cameraPerspective_int == 0)
                {
                    GUILayout.Space(5f);
                    GUILayout.Label("By default, 2D games are built entirely in the X-Z plane, and characters are scaled to achieve a depth effect.\nIf you prefer, you can position your characters in 3D space, so that they scale accurately due to camera perspective.");
                    screenSpace = EditorGUILayout.ToggleLeft("I'll position my characters in 3D space", screenSpace);
                }
                else if (cameraPerspective_int == 1)
                {
                    GUILayout.Space(5f);
                    GUILayout.Label("2.5D games mixes 3D characters with 2D backgrounds. By default, 2.5D games group several backgrounds into one scene, and swap them out according to the camera angle.\nIf you prefer, you can work with just one background in a scene, to create a more traditional 2D-like adventure.");
                    oneScenePerBackground = EditorGUILayout.ToggleLeft("I'll work with one background per scene", oneScenePerBackground);
                }
                else if (cameraPerspective_int == 2)
                {
                    GUILayout.Label("3D games can still have sprite-based Characters, but having a true 3D environment is more flexible so far as Player control goes. How should your Player character be controlled?");
                    movementMethod = (MovementMethod)EditorGUILayout.EnumPopup(movementMethod);
                }
            }

            else if (pageNumber == 3)
            {
                if (cameraPerspective_int == 1 && !oneScenePerBackground)
                {
                    GUILayout.Label("Do you want to play the game ONLY with a keyboard or controller?");
                    directControl = EditorGUILayout.ToggleLeft("Yes", directControl);
                    GUILayout.Space(5f);
                }
                else if (cameraPerspective_int == 2 && movementMethod == MovementMethod.Drag)
                {
                    GUILayout.Label("Is your game designed for Touch-screen devices?");
                    touchScreen = EditorGUILayout.ToggleLeft("Yes", touchScreen);
                    GUILayout.Space(5f);
                }

                GUILayout.Label("How do you want to interact with Hotspots?");
                interactionMethod = (AC_InteractionMethod)EditorGUILayout.EnumPopup(interactionMethod);
                if (interactionMethod == AC_InteractionMethod.ContextSensitive)
                {
                    EditorGUILayout.HelpBox("This method simplifies interactions to either Use, Examine, or Use Inventory. Hotspots can be interacted with in just one click.", MessageType.Info);
                }
                else if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                {
                    EditorGUILayout.HelpBox("This method emulates the classic 'Sierra-style' interface, in which the player chooses from a list of verbs, and then the Hotspot they wish to interact with.", MessageType.Info);
                }
                else if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    EditorGUILayout.HelpBox("This method involves first choosing a Hotspot, and then from a range of available interactions, which can be customised in the Editor.", MessageType.Info);
                }
                else if (interactionMethod == AC_InteractionMethod.CustomScript)
                {
                    EditorGUILayout.HelpBox("See the Manual's 'Custom interaction systems' section for information on how to trigger Hotspots and inventory items.", MessageType.Info);
                }
            }

            else if (pageNumber == 4)
            {
                GUILayout.Label("Please choose what interface you would like to start with. It can be changed at any time - this is just to help you get started.");
                wizardMenu = (WizardMenu)EditorGUILayout.EnumPopup(wizardMenu);

                if (wizardMenu == WizardMenu.DefaultAC || wizardMenu == WizardMenu.DefaultUnityUI)
                {
                    MenuManager    defaultMenuManager    = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_MenuManager.asset", typeof(MenuManager)) as MenuManager;
                    CursorManager  defaultCursorManager  = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_CursorManager.asset", typeof(CursorManager)) as CursorManager;
                    ActionsManager defaultActionsManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_ActionsManager.asset", typeof(ActionsManager)) as ActionsManager;

                    if (defaultMenuManager == null || defaultCursorManager == null || defaultActionsManager == null)
                    {
                        EditorGUILayout.HelpBox("Unable to locate the default Manager assets in '" + Resource.MainFolderPath + "/Default'. These assets must be imported in order to start with the default interface.", MessageType.Warning);
                    }
                }

                if (wizardMenu == WizardMenu.Blank)
                {
                    EditorGUILayout.HelpBox("Your interface will be completely blank - no cursor icons will exist either.\r\n\r\nThis option is not recommended for those still learning how to use AC.", MessageType.Info);
                }
                else if (wizardMenu == WizardMenu.DefaultAC)
                {
                    EditorGUILayout.HelpBox("This mode uses AC's built-in Menu system and not Unity UI.\r\n\r\nUnity UI prefabs will also be created for each Menu, however, so that you can make use of them later if you choose.", MessageType.Info);
                }
                else if (wizardMenu == WizardMenu.DefaultUnityUI)
                {
                    EditorGUILayout.HelpBox("This mode relies on Unity UI to handle the interface.\r\n\r\nCopies of the UI prefabs will be stored in a UI subdirectory, for you to edit.", MessageType.Info);
                }
            }

            else if (pageNumber == 5)
            {
                GUILayout.Label("The following values have been set based on your choices. Please review them and amend if necessary, then click 'Finish' to create your game template.");
                GUILayout.Space(5f);

                gameName = EditorGUILayout.TextField("Game name:", gameName);
                cameraPerspective_int = (int)cameraPerspective;
                cameraPerspective_int = EditorGUILayout.Popup("Camera perspective:", cameraPerspective_int, cameraPerspective_list);
                cameraPerspective     = (CameraPerspective)cameraPerspective_int;

                if (cameraPerspective == CameraPerspective.TwoD)
                {
                    movingTurning = (MovingTurning)EditorGUILayout.EnumPopup("Moving and turning:", movingTurning);
                }

                movementMethod    = (MovementMethod)EditorGUILayout.EnumPopup("Movement method:", movementMethod);
                inputMethod       = (InputMethod)EditorGUILayout.EnumPopup("Input method:", inputMethod);
                interactionMethod = (AC_InteractionMethod)EditorGUILayout.EnumPopup("Interaction method:", interactionMethod);
                hotspotDetection  = (HotspotDetection)EditorGUILayout.EnumPopup("Hotspot detection method:", hotspotDetection);

                wizardMenu = (WizardMenu)EditorGUILayout.EnumPopup("GUI type:", wizardMenu);
            }

            else if (pageNumber == 6)
            {
                GUILayout.Label("Congratulations, your game's Managers have been set up!");
                GUILayout.Space(5f);
                GUILayout.Label("Your next step is to create and set your Player prefab, which you can do using the Character Wizard.");
            }
        }
示例#31
0
        public override void OnInspectorGUI()
        {
            if (!sideIcon)
            {
                sideIcon = (Texture2D) AssetDatabase.LoadAssetAtPath ("Assets/AdventureCreator/Graphics/Textures/inspector-use.png", typeof (Texture2D));
            }

            if (AdvGame.GetReferences () == null)
            {
                ACDebug.LogError ("A References file is required - please use the Adventure Creator window to create one.");
                EditorGUILayout.LabelField ("No References file found!");
            }
            else
            {
                if (AdvGame.GetReferences ().inventoryManager)
                {
                    inventoryManager = AdvGame.GetReferences ().inventoryManager;
                }
                if (AdvGame.GetReferences ().cursorManager)
                {
                    cursorManager = AdvGame.GetReferences ().cursorManager;
                }
                if (AdvGame.GetReferences ().settingsManager)
                {
                    settingsManager = AdvGame.GetReferences ().settingsManager;
                }

                if (Application.isPlaying)
                {
                    if (_target.gameObject.layer != LayerMask.NameToLayer (settingsManager.hotspotLayer))
                    {
                        EditorGUILayout.HelpBox ("Current state: OFF", MessageType.Info);
                    }
                }

                if (_target.lineID > -1)
                {
                    EditorGUILayout.LabelField ("Speech Manager ID:", _target.lineID.ToString ());
                }

                _target.interactionSource = (InteractionSource) EditorGUILayout.EnumPopup ("Interaction source:", _target.interactionSource);
                _target.hotspotName = EditorGUILayout.TextField ("Label (if not name):", _target.hotspotName);
                _target.highlight = (Highlight) EditorGUILayout.ObjectField ("Object to highlight:", _target.highlight, typeof (Highlight), true);

                EditorGUILayout.BeginHorizontal ();
                _target.centrePoint = (Transform) EditorGUILayout.ObjectField ("Centre point (override):", _target.centrePoint, typeof (Transform), true);

                if (_target.centrePoint == null)
                {
                    if (GUILayout.Button ("Create", autoWidth))
                    {
                        string prefabName = "Hotspot centre: " + _target.gameObject.name;
                        GameObject go = SceneManager.AddPrefab ("Navigation", "HotspotCentre", true, false, false);
                        go.name = prefabName;
                        go.transform.position = _target.transform.position;
                        _target.centrePoint = go.transform;
                        if (GameObject.Find ("_Markers"))
                        {
                            go.transform.parent = GameObject.Find ("_Markers").transform;
                        }
                    }
                }
                EditorGUILayout.EndHorizontal ();

                EditorGUILayout.BeginHorizontal ();
                _target.walkToMarker = (Marker) EditorGUILayout.ObjectField ("Walk-to marker:", _target.walkToMarker, typeof (Marker), true);

                if (_target.walkToMarker == null)
                {
                    if (GUILayout.Button ("Create", autoWidth))
                    {
                        string prefabName = "Marker";
                        if (settingsManager && settingsManager.IsUnity2D ())
                        {
                            prefabName += "2D";
                        }
                        Marker newMarker = SceneManager.AddPrefab ("Navigation", prefabName, true, false, true).GetComponent <Marker>();
                        newMarker.gameObject.name += (": " + _target.gameObject.name);
                        newMarker.transform.position = _target.transform.position;
                        _target.walkToMarker = newMarker;
                    }
                }
                EditorGUILayout.EndHorizontal ();

                _target.limitToCamera = (_Camera) EditorGUILayout.ObjectField ("Limit to camera:", _target.limitToCamera, typeof (_Camera), true);
                _target.drawGizmos = EditorGUILayout.Toggle ("Draw yellow cube?", _target.drawGizmos);

                if (settingsManager != null && settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive)
                {
                    _target.oneClick = EditorGUILayout.Toggle ("Single 'Use' Interaction?", _target.oneClick);
                }
                if (_target.oneClick || (settingsManager != null && settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive))
                {
                    _target.doubleClickingHotspot = (DoubleClickingHotspot) EditorGUILayout.EnumPopup ("Double-clicking:", _target.doubleClickingHotspot);
                }

                EditorGUILayout.Space ();

                UseInteractionGUI ();

                if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive)
                {
                    EditorGUILayout.Space ();
                    LookInteractionGUI ();
                }

                EditorGUILayout.Space ();
                InvInteractionGUI ();

                EditorGUILayout.Space ();
                UnhandledInvInteractionGUI ();
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty (_target);
            }
        }
示例#32
0
        public override void OnInspectorGUI()
        {
            if (!sideIcon)
            {
                sideIcon = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Graphics/Textures/inspector-use.png", typeof(Texture2D));
            }

            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 (AdvGame.GetReferences().inventoryManager)
                {
                    inventoryManager = AdvGame.GetReferences().inventoryManager;
                }
                if (AdvGame.GetReferences().cursorManager)
                {
                    cursorManager = AdvGame.GetReferences().cursorManager;
                }
                if (AdvGame.GetReferences().settingsManager)
                {
                    settingsManager = AdvGame.GetReferences().settingsManager;
                }

                if (_target.lineID > -1)
                {
                    EditorGUILayout.LabelField("Speech Manager ID:", _target.lineID.ToString());
                }

                _target.interactionSource = (InteractionSource)EditorGUILayout.EnumPopup("Interaction source:", _target.interactionSource);
                _target.hotspotName       = EditorGUILayout.TextField("Label (if not name):", _target.hotspotName);
                _target.highlight         = (Highlight)EditorGUILayout.ObjectField("Object to highlight:", _target.highlight, typeof(Highlight), true);

                EditorGUILayout.BeginHorizontal();
                _target.centrePoint = (Transform)EditorGUILayout.ObjectField("Centre point (override):", _target.centrePoint, typeof(Transform), true);

                if (_target.centrePoint == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        string     prefabName = "Hotspot centre: " + _target.gameObject.name;
                        GameObject go         = SceneManager.AddPrefab("Navigation", "HotspotCentre", true, false, false);
                        go.name = prefabName;
                        go.transform.position = _target.transform.position;
                        _target.centrePoint   = go.transform;
                        if (GameObject.Find("_Markers"))
                        {
                            go.transform.parent = GameObject.Find("_Markers").transform;
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                _target.walkToMarker = (Marker)EditorGUILayout.ObjectField("Walk-to marker:", _target.walkToMarker, typeof(Marker), true);

                if (_target.walkToMarker == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        string prefabName = "Marker";
                        if (settingsManager && settingsManager.IsUnity2D())
                        {
                            prefabName += "2D";
                        }
                        Marker newMarker = SceneManager.AddPrefab("Navigation", prefabName, true, false, true).GetComponent <Marker>();
                        newMarker.gameObject.name   += (": " + _target.gameObject.name);
                        newMarker.transform.position = _target.transform.position;
                        _target.walkToMarker         = newMarker;
                    }
                }
                EditorGUILayout.EndHorizontal();

                _target.drawGizmos = EditorGUILayout.Toggle("Draw yellow cube?", _target.drawGizmos);

                if (settingsManager != null && settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive)
                {
                    _target.oneClick = EditorGUILayout.Toggle("Single 'Use' Interaction?", _target.oneClick);
                }
                EditorGUILayout.Space();

                UseInteractionGUI();

                if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive)
                {
                    EditorGUILayout.Space();
                    LookInteractionGUI();
                }

                EditorGUILayout.Space();
                InvInteractionGUI();
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(_target);
            }
        }
        public void ShowGUI()
        {
            SettingsManager settingsManager = KickStarter.settingsManager;

            if (settingsManager == null)
            {
                EditorGUILayout.HelpBox("A Settings Manager must be assigned in the AC Game Window.", MessageType.Warning);
                return;
            }

            InventoryManager inventoryManager = KickStarter.inventoryManager;

            if (inventoryManager == null)
            {
                EditorGUILayout.HelpBox("An Inventory Manager must be assigned in the AC Game Window.", MessageType.Warning);
                return;
            }

            List <string> itemList  = new List <string>();
            int           itemIndex = 0;

            if (inventoryManager.items.Count > 0)
            {
                for (int i = 0; i < inventoryManager.items.Count; i++)
                {
                    itemList.Add(inventoryManager.items[i].label);
                    if (inventoryManager.items[i].id == itemID)
                    {
                        itemIndex = i;
                    }
                }
            }

            if (itemList.Count == 0)
            {
                EditorGUILayout.HelpBox("No inventory items found!", MessageType.Warning);
                return;
            }

            itemIndex = EditorGUILayout.Popup("Inventory item:", itemIndex, itemList.ToArray());

            if (itemIndex >= inventoryManager.items.Count)
            {
                return;
            }

            itemID = inventoryManager.items[itemIndex].id;

            InvItem item = inventoryManager.GetItem(itemID);

            if (item != null)
            {
                if (settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && settingsManager.inventoryInteractions == InventoryInteractions.Multiple)
                {
                    // Standard interactions

                    CursorManager cursorManager = KickStarter.cursorManager;
                    if (cursorManager == null)
                    {
                        EditorGUILayout.HelpBox("A Cursor Manager must be assigned in the AC Game Window.", MessageType.Warning);
                        return;
                    }

                    List <string> iconList = new List <string>();
                    foreach (CursorIcon icon in cursorManager.cursorIcons)
                    {
                        iconList.Add(icon.label);
                    }

                    List <string> interactionList = new List <string>();
                    for (int i = 0; i < item.interactions.Count; i++)
                    {
                        int    iconID = item.interactions[i].icon.id;
                        int    index  = GetIconSlot(iconID, cursorManager.cursorIcons.ToArray());
                        string label  = i.ToString() + ": " + cursorManager.cursorIcons[index].label;
                        if (string.IsNullOrEmpty(label))
                        {
                            label = i.ToString() + ": Unnamed";
                        }
                        interactionList.Add(label);
                    }

                    if (interactionList.Count == 0)
                    {
                        EditorGUILayout.HelpBox("No standard interactions found!", MessageType.Warning);
                        return;
                    }

                    cursorIndex = EditorGUILayout.Popup("Interaction:", cursorIndex, interactionList.ToArray());
                    ShowParametersGUI(item.interactions[cursorIndex].actionList);
                }
                else
                {
                    interactionType = (InteractionType)EditorGUILayout.EnumPopup("Interaction type:", interactionType);
                    switch (interactionType)
                    {
                    case InteractionType.Use:
                        ShowParametersGUI(item.useActionList);
                        break;

                    case InteractionType.Examine:
                        ShowParametersGUI(item.lookActionList);
                        break;
                    }
                }
            }
        }
示例#34
0
        public override void OnInspectorGUI()
        {
            if (AdvGame.GetReferences() == null)
            {
                ACDebug.LogError("A References file is required - please use the Adventure Creator window to create one.");
                EditorGUILayout.LabelField("No References file found!");
            }
            else
            {
                if (AdvGame.GetReferences().inventoryManager)
                {
                    inventoryManager = AdvGame.GetReferences().inventoryManager;
                }
                if (AdvGame.GetReferences().cursorManager)
                {
                    cursorManager = AdvGame.GetReferences().cursorManager;
                }
                if (AdvGame.GetReferences().settingsManager)
                {
                    settingsManager = AdvGame.GetReferences().settingsManager;
                }

                if (Application.isPlaying)
                {
                    if (_target.gameObject.layer != LayerMask.NameToLayer(settingsManager.hotspotLayer))
                    {
                        EditorGUILayout.HelpBox("Current state: OFF", MessageType.Info);
                    }
                }

                if (_target.lineID > -1)
                {
                    EditorGUILayout.LabelField("Speech Manager ID:", _target.lineID.ToString());
                }

                _target.interactionSource = (AC.InteractionSource)CustomGUILayout.EnumPopup("Interaction source:", _target.interactionSource, "", "The source of the commands that are run when an option is chosen");
                _target.hotspotName       = CustomGUILayout.TextField("Label (if not name):", _target.hotspotName, "", "The display name, if not the GameObject's name");
                _target.highlight         = (Highlight)CustomGUILayout.ObjectField <Highlight> ("Object to highlight:", _target.highlight, true, "", "The Highlight component that controls any highlighting effects associated with the Hotspot");

                if (AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.hotspotDrawing == ScreenWorld.WorldSpace)
                {
                    _target.iconSortingLayer = CustomGUILayout.TextField("Icon sorting layer:", _target.iconSortingLayer, "", "The 'Sorting Layer' of the icon's SpriteRenderer");
                    _target.iconSortingOrder = CustomGUILayout.IntField("Icon sprite order:", _target.iconSortingOrder, "", "The 'Order in Layer' of the icon's SpriteRenderer");
                }

                EditorGUILayout.BeginHorizontal();
                _target.centrePoint = (Transform)CustomGUILayout.ObjectField <Transform> ("Centre point (override):", _target.centrePoint, true, "", "A Transform that represents the centre of the Hotspot, if it is not physically at the same point as the Hotspot's GameObject itself");

                if (_target.centrePoint == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        string     prefabName = "Hotspot centre: " + _target.gameObject.name;
                        GameObject go         = SceneManager.AddPrefab("Navigation", "HotspotCentre", true, false, false);
                        go.name = prefabName;
                        go.transform.position = _target.transform.position;
                        _target.centrePoint   = go.transform;
                        go.transform.parent   = _target.transform;
                    }
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                _target.walkToMarker = (Marker)CustomGUILayout.ObjectField <Marker> ("Walk-to Marker:", _target.walkToMarker, true, "", "The Marker that the player can optionally automatically walk to before an Interaction runs");
                if (_target.walkToMarker == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        string prefabName = "Marker";
                        if (SceneSettings.IsUnity2D())
                        {
                            prefabName += "2D";
                        }
                        Marker newMarker = SceneManager.AddPrefab("Navigation", prefabName, true, false, true).GetComponent <Marker>();
                        newMarker.gameObject.name   += (": " + _target.gameObject.name);
                        newMarker.transform.position = _target.transform.position;
                        _target.walkToMarker         = newMarker;
                    }
                }
                EditorGUILayout.EndHorizontal();

                _target.limitToCamera = (_Camera)CustomGUILayout.ObjectField <_Camera> ("Limit to camera:", _target.limitToCamera, true, "", "If assigned, then the Hotspot will only be interactive when the assigned _Camera is active");

                EditorGUILayout.BeginHorizontal();
                _target.interactiveBoundary = (InteractiveBoundary)CustomGUILayout.ObjectField <InteractiveBoundary> ("Interactive boundary:", _target.interactiveBoundary, true, "", "If assigned, then the Hotspot will only be interactive when the player is within this Trigger Collider's boundary");
                if (_target.interactiveBoundary == null)
                {
                    if (GUILayout.Button("Create", autoWidth))
                    {
                        string prefabName = "InteractiveBoundary";
                        if (SceneSettings.IsUnity2D())
                        {
                            prefabName += "2D";
                        }
                        InteractiveBoundary newInteractiveBoundary = SceneManager.AddPrefab("Logic", prefabName, true, false, true).GetComponent <InteractiveBoundary>();
                        newInteractiveBoundary.gameObject.name   += (": " + _target.gameObject.name);
                        newInteractiveBoundary.transform.position = _target.transform.position;
                        _target.interactiveBoundary = newInteractiveBoundary;

                        UnityVersionHandler.PutInFolder(newInteractiveBoundary.gameObject, "_Hotspots");
                    }
                }
                EditorGUILayout.EndHorizontal();

                _target.drawGizmos = CustomGUILayout.Toggle("Draw yellow cube?", _target.drawGizmos, "", "If True, then a Gizmo may be drawn in the Scene window at the Hotspots's position");

                if (settingsManager != null && (settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction || settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot || settingsManager.interactionMethod == AC_InteractionMethod.CustomScript))
                {
                    _target.oneClick = CustomGUILayout.Toggle("Single 'Use' Interaction?", _target.oneClick, "", "If True, then clicking the Hotspot will run the Hotspot's first interaction in useButtons, regardless of the Settings Manager's Interaction method");

                    if (_target.oneClick && settingsManager.interactionMethod == AC_InteractionMethod.CustomScript)
                    {
                        EditorGUILayout.HelpBox("The above property can be accessed by reading the Hotspot script's IsSingleInteraction() method.", MessageType.Info);
                    }
                }
                if (_target.oneClick || (settingsManager != null && settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive))
                {
                    if (settingsManager != null && settingsManager.interactionMethod == AC_InteractionMethod.CustomScript)
                    {
                    }
                    else
                    {
                        _target.doubleClickingHotspot = (DoubleClickingHotspot)CustomGUILayout.EnumPopup("Double-clicking:", _target.doubleClickingHotspot, "", "The effect that double-clicking on the Hotspot has");
                    }
                }
                if (settingsManager != null && settingsManager.playerFacesHotspots)
                {
                    _target.playerTurnsHead = CustomGUILayout.Toggle("Players turn heads when active?", _target.playerTurnsHead, "", "If True, then the player will turn their head when the Hotspot is selected");
                }

                EditorGUILayout.Space();

                UseInteractionGUI();

                if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive || settingsManager.interactionMethod == AC_InteractionMethod.CustomScript)
                {
                    EditorGUILayout.Space();
                    LookInteractionGUI();
                }

                EditorGUILayout.Space();
                InvInteractionGUI();

                EditorGUILayout.Space();
                UnhandledInvInteractionGUI();
            }

            UnityVersionHandler.CustomSetDirty(_target);
        }
示例#35
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;
                CursorManager    cursorManager    = AdvGame.GetReferences().cursorManager;
                MenuManager      menuManager      = AdvGame.GetReferences().menuManager;

                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 (settingsManager.IsInLoadingScene())
                    {
                        Debug.Log("Bypassing regular AC startup because the current scene is the 'Loading' scene.");
                        return;
                    }
                    if (!GameObject.FindGameObjectWithTag(Tags.player))
                    {
                        KickStarter.ResetPlayer(settingsManager.GetDefaultPlayer(), settingsManager.GetDefaultPlayerID(), false, Quaternion.identity);
                    }
                    else
                    {
                        KickStarter.playerPrefab = GameObject.FindWithTag(Tags.player).GetComponent <Player>();

                        if (sceneChanger != null && sceneChanger.GetPlayerOnTransition() != null && settingsManager.playerSwitching == PlayerSwitching.DoNotAllow)
                        {
                            // Replace "prefab" player with a local one if one exists
                            GameObject[] playerObs = GameObject.FindGameObjectsWithTag(Tags.player);
                            foreach (GameObject playerOb in playerObs)
                            {
                                if (playerOb.GetComponent <Player>() && sceneChanger.GetPlayerOnTransition() != playerOb.GetComponent <Player>())
                                {
                                    KickStarter.sceneChanger.DestroyOldPlayer();
                                    KickStarter.playerPrefab = playerOb.GetComponent <Player>();
                                    break;
                                }
                            }
                        }
                    }
                }

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

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

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

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

                if (cursorManager == null)
                {
                    Debug.LogError("No Cursor Manager found - please set one using the main Adventure Creator window");
                }

                if (menuManager == null)
                {
                    Debug.LogError("No Menu Manager found - please set one using the main Adventure Creator window");
                }

                if (GameObject.FindWithTag(Tags.player) == null && KickStarter.settingsManager.movementMethod != MovementMethod.None)
                {
                    Debug.LogWarning("No Player found - please set one using the Settings Manager, tagging it as Player and placing it in a Resources folder");
                }
            }
            else
            {
                Debug.LogError("No References object found. Please set one using the main Adventure Creator window");
            }

            if (persistentEnginePrefab == null)
            {
                try
                {
                    persistentEnginePrefab      = (GameObject)Instantiate(Resources.Load(Resource.persistentEngine));
                    persistentEnginePrefab.name = AdvGame.GetName(Resource.persistentEngine);
                }
                catch {}
            }

            if (persistentEnginePrefab == null)
            {
                Debug.LogError("No PersistentEngine prefab found - please place one in the Resources directory, and tag it as PersistentEngine");
            }
            else
            {
                if (persistentEnginePrefab.GetComponent <Options>() == null)
                {
                    Debug.LogError(persistentEnginePrefab.name + " has no Options component attached.");
                }
                if (persistentEnginePrefab.GetComponent <RuntimeInventory>() == null)
                {
                    Debug.LogError(persistentEnginePrefab.name + " has no RuntimeInventory component attached.");
                }
                if (persistentEnginePrefab.GetComponent <RuntimeVariables>() == null)
                {
                    Debug.LogError(persistentEnginePrefab.name + " has no RuntimeVariables component attached.");
                }
                if (persistentEnginePrefab.GetComponent <PlayerMenus>() == null)
                {
                    Debug.LogError(persistentEnginePrefab.name + " has no PlayerMenus component attached.");
                }
                if (persistentEnginePrefab.GetComponent <StateHandler>() == null)
                {
                    Debug.LogError(persistentEnginePrefab.name + " has no StateHandler component attached.");
                }
                if (persistentEnginePrefab.GetComponent <SceneChanger>() == null)
                {
                    Debug.LogError(persistentEnginePrefab.name + " has no SceneChanger component attached.");
                }
                if (persistentEnginePrefab.GetComponent <SaveSystem>() == null)
                {
                    Debug.LogError(persistentEnginePrefab.name + " has no SaveSystem component attached.");
                }
                if (persistentEnginePrefab.GetComponent <LevelStorage>() == null)
                {
                    Debug.LogError(persistentEnginePrefab.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.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 <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 <PlayerQTE>() == null)
            {
                Debug.LogError(this.name + " has no PlayerQTE component attached.");
            }
            if (this.GetComponent <SceneSettings>() == null)
            {
                Debug.LogError(this.name + " has no SceneSettings component attached.");
            }
            else
            {
                if (this.GetComponent <SceneSettings>().navigationMethod == AC_NavigationMethod.meshCollider && this.GetComponent <SceneSettings>().navMesh == null)
                {
                    // No NavMesh, are there Characters in the scene?
                    AC.Char[] allChars = GameObject.FindObjectsOfType(typeof(AC.Char)) as AC.Char[];
                    if (allChars.Length > 0)
                    {
                        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 <NavigationManager>() == null)
            {
                Debug.LogError(this.name + " has no NavigationManager component attached.");
            }
            if (this.GetComponent <ActionListManager>() == null)
            {
                Debug.LogError(this.name + " has no ActionListManager component attached.");
            }
        }