Beispiel #1
0
        private void DrawReviewStage()
        {
            EditorGUILayout.LabelField("Review", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("Your Player is ready! Below is a summary of the configuration.", MessageType.Info);
            SimpleController     simpleController     = pcObject.GetComponent <SimpleController>();
            NavigateOnMouseClick navigateOnMouseClick = pcObject.GetComponent <NavigateOnMouseClick>();

            if (simpleController != null)
            {
                EditorGUILayout.LabelField("Control: Third-Person Shooter Style");
            }
            else if (navigateOnMouseClick != null)
            {
                EditorGUILayout.LabelField("Control: Follow Mouse Clicks");
            }
            else
            {
                EditorGUILayout.LabelField("Control: Custom");
            }
            switch (GetSelectorType())
            {
            case SelectorType.CenterOfScreen: EditorGUILayout.LabelField("Targeting: Center of Screen"); break;

            case SelectorType.CustomPosition: EditorGUILayout.LabelField("Targeting: Custom Position (you must set Selector.CustomPosition)"); break;

            case SelectorType.MousePosition: EditorGUILayout.LabelField("Targeting: Mouse Position"); break;

            case SelectorType.Proximity: EditorGUILayout.LabelField("Targeting: Proximity"); break;

            default: EditorGUILayout.LabelField("Targeting: None"); break;
            }
            SetEnabledOnDialogueEvent enabler = FindConversationEnabler();

            if (enabler != null)
            {
                ShowDisabledComponents(enabler.onStart);
            }
            ShowCursorOnConversation showCursor = pcObject.GetComponentInChildren <ShowCursorOnConversation>();

            if (showCursor != null)
            {
                EditorGUILayout.LabelField("Show Cursor During Conversations: Yes");
            }
            PersistentPositionData persistentPositionData = pcObject.GetComponentInChildren <PersistentPositionData>();

            EditorGUILayout.LabelField(string.Format("Save Position: {0}", (persistentPositionData != null) ? "Yes" : "No"));
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, true);
        }
Beispiel #2
0
        private void DrawDisableControlsSection()
        {
            EditorWindowTools.StartIndentedSection();
            SetEnabledOnDialogueEvent enabler = FindConversationEnabler();

            if (setEnabledFlag)
            {
                if (enabler == null)
                {
                    enabler = pcObject.AddComponent <SetEnabledOnDialogueEvent>();
                }
                enabler.trigger = DialogueEvent.OnConversation;
                enabler.onStart = GetPlayerControls(enabler.onStart, Toggle.False);
                enabler.onEnd   = GetPlayerControls(enabler.onEnd, Toggle.True);
                ShowDisabledComponents(enabler.onStart);
            }
            else
            {
                DestroyImmediate(enabler);
            }
            EditorWindowTools.EndIndentedSection();
        }
Beispiel #3
0
        private void DrawTransitionStage()
        {
            EditorGUILayout.LabelField("Gameplay/Conversation Transition", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            SetEnabledOnDialogueEvent setEnabled = pcObject.GetComponent <SetEnabledOnDialogueEvent>();

            setEnabledFlag = setEnabledFlag || (setEnabled != null);
            if (!setEnabledFlag)
            {
                EditorGUILayout.HelpBox("Gameplay components, such as movement and camera control, will interfere with conversations. If you want to disable gameplay components during conversations, tick the checkbox below.", MessageType.None);
            }
            EditorGUILayout.BeginHorizontal();
            setEnabledFlag = EditorGUILayout.Toggle(setEnabledFlag, GUILayout.Width(ToggleWidth));
            EditorGUILayout.LabelField("Disable gameplay components during conversations", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            DrawDisableControlsSection();
            DrawShowCursorSection();
            if (GUILayout.Button("Select Player", GUILayout.Width(100)))
            {
                Selection.activeGameObject = pcObject;
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }
		private SetEnabledOnDialogueEvent.SetEnabledAction[] GetPlayerControls(SetEnabledOnDialogueEvent.SetEnabledAction[] oldList, Toggle state) {
			List<SetEnabledOnDialogueEvent.SetEnabledAction> actions = new List<SetEnabledOnDialogueEvent.SetEnabledAction>();
			if (oldList != null) {
				actions.AddRange(oldList);
			}
			foreach (var component in pcObject.GetComponents<MonoBehaviour>()) {
				if (IsPlayerControlComponent(component) && !IsInActionList(actions, component)) {
					AddToActionList(actions, component, state);
				}
			}
			SmoothCameraWithBumper smoothCamera = pcObject.GetComponentInChildren<SmoothCameraWithBumper>();
			if (smoothCamera == null) smoothCamera = UnityEngine.Camera.main.GetComponent<SmoothCameraWithBumper>();
			if ((smoothCamera != null) && !IsInActionList(actions, smoothCamera)) {
				AddToActionList(actions, smoothCamera, state);
			}
			actions.RemoveAll(a => ((a == null) || (a.target == null)));
			return actions.ToArray();
		}
		private void ShowDisabledComponents(SetEnabledOnDialogueEvent.SetEnabledAction[] actionList) {
			EditorGUILayout.LabelField("The following components will be disabled during conversations:");
			EditorWindowTools.StartIndentedSection();
			foreach (SetEnabledOnDialogueEvent.SetEnabledAction action in actionList) {
				if (action.target != null) {
					EditorGUILayout.LabelField(action.target.GetType().Name);
				}							
			}
			EditorWindowTools.EndIndentedSection();
		}