Пример #1
0
        private void DrawTargetingStage()
        {
            DrawOverrideNameSubsection(npcObject);
            EditorGUILayout.LabelField("Targeting", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            ConversationTrigger conversationTrigger = npcObject.GetComponentInChildren <ConversationTrigger>();
            BarkTrigger         barkTrigger         = npcObject.GetComponentInChildren <BarkTrigger>();
            bool hasOnTriggerEnter = ((conversationTrigger != null) && (conversationTrigger.trigger == DialogueTriggerEvent.OnTriggerEnter)) ||
                                     ((barkTrigger != null) && (barkTrigger.trigger == DialogueTriggerEvent.OnTriggerEnter));
            bool hasOnUse = ((conversationTrigger != null) && (conversationTrigger.trigger == DialogueTriggerEvent.OnUse)) ||
                            ((barkTrigger != null) && (barkTrigger.trigger == DialogueTriggerEvent.OnUse));
            bool needsColliders          = hasOnTriggerEnter || hasOnUse;
            bool hasAppropriateColliders = false;

            if (hasOnTriggerEnter)
            {
                hasAppropriateColliders = DrawTargetingOnTriggerEnter();
            }
            if (hasOnUse)
            {
                hasAppropriateColliders = DrawTargetingOnUse() || hasAppropriateColliders;
            }
            if (!needsColliders)
            {
                EditorGUILayout.HelpBox("The NPC doesn't need any targeting components. Click Next to proceed.", MessageType.Info);
            }
            if (GUILayout.Button("Select NPC", GUILayout.Width(100)))
            {
                Selection.activeGameObject = npcObject;
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, (hasAppropriateColliders || !needsColliders), false);
        }
Пример #2
0
        private void DrawReviewStage()
        {
            EditorGUILayout.LabelField("Review", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("Your NPC is ready! Below is a summary of your NPC's configuration.", MessageType.Info);
            ConversationTrigger conversationTrigger = npcObject.GetComponentInChildren <ConversationTrigger>();

            if (conversationTrigger != null)
            {
                EditorGUILayout.LabelField(string.Format("Conversation: '{0}'{1} {2}", conversationTrigger.conversation, conversationTrigger.once ? " (once)" : string.Empty, conversationTrigger.trigger));
            }
            else
            {
                EditorGUILayout.LabelField("Conversation: None");
            }
            BarkTrigger barkTrigger = npcObject.GetComponentInChildren <BarkTrigger>();

            if (barkTrigger != null)
            {
                EditorGUILayout.LabelField(string.Format("Triggered Bark: '{0}' ({1}) {2}", barkTrigger.conversation, barkTrigger.barkOrder, barkTrigger.trigger));
            }
            else
            {
                EditorGUILayout.LabelField("Triggered Bark: None");
            }
            BarkOnIdle barkOnIdle = npcObject.GetComponentInChildren <BarkOnIdle>();

            if (barkOnIdle != null)
            {
                EditorGUILayout.LabelField(string.Format("Timed Bark: '{0}' ({1}) every {2}-{3} seconds", barkOnIdle.conversation, barkOnIdle.barkOrder, barkOnIdle.minSeconds, barkOnIdle.maxSeconds));
            }
            else
            {
                EditorGUILayout.LabelField("Timed Bark: No");
            }
            PersistentPositionData persistentPositionData = npcObject.GetComponentInChildren <PersistentPositionData>();

            EditorGUILayout.LabelField(string.Format("Save Position: {0}", (persistentPositionData != null) ? "Yes" : "No"));
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, true);
        }
Пример #3
0
        private void DrawReviewStage()
        {
            EditorGUILayout.LabelField("Review", EditorStyles.boldLabel);
            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("Your NPC is ready! Below is a summary of your NPC's configuration.\n\nNPC configuration can sometimes be complex. This wizard can't anticipate every possible character design. If your NPC doesn't behave the way you expect, please examine the components on the NPC and make adjustments as necessary.", MessageType.Info);
            ConversationTrigger conversationTrigger = npcObject.GetComponentInChildren <ConversationTrigger>();

            if (conversationTrigger != null)
            {
                EditorGUILayout.LabelField(string.Format("Conversation: '{0}'{1} {2}", conversationTrigger.conversation, conversationTrigger.once ? " (once)" : string.Empty, conversationTrigger.trigger));
            }
            else
            {
                EditorGUILayout.LabelField("Conversation: None");
            }
            BarkTrigger barkTrigger = npcObject.GetComponentInChildren <BarkTrigger>();

            if (barkTrigger != null)
            {
                EditorGUILayout.LabelField(string.Format("Triggered Bark: '{0}' ({1}) {2}", barkTrigger.conversation, barkTrigger.barkOrder, barkTrigger.trigger));
            }
            else
            {
                EditorGUILayout.LabelField("Triggered Bark: None");
            }
            BarkOnIdle barkOnIdle = npcObject.GetComponentInChildren <BarkOnIdle>();

            if (barkOnIdle != null)
            {
                EditorGUILayout.LabelField(string.Format("Timed Bark: '{0}' ({1}) every {2}-{3} seconds", barkOnIdle.conversation, barkOnIdle.barkOrder, barkOnIdle.minSeconds, barkOnIdle.maxSeconds));
            }
            else
            {
                EditorGUILayout.LabelField("Timed Bark: No");
            }
            PersistentPositionData persistentPositionData = npcObject.GetComponentInChildren <PersistentPositionData>();

            EditorGUILayout.LabelField(string.Format("Save Position: {0}", (persistentPositionData != null) ? "Yes" : "No"));
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, true);
        }
Пример #4
0
        private void DrawConversationStage()
        {
            EditorGUILayout.LabelField("Conversation", EditorStyles.boldLabel);
            ConversationTrigger conversationTrigger = npcObject.GetComponentInChildren <ConversationTrigger>();

            EditorWindowTools.StartIndentedSection();
            EditorGUILayout.HelpBox("If the NPC has an interactive conversation (for example, with the player), tick the checkbox below.", MessageType.Info);
            EditorGUILayout.BeginHorizontal();
            bool hasConversation = EditorGUILayout.Toggle((conversationTrigger != null), GUILayout.Width(ToggleWidth));

            EditorGUILayout.LabelField("NPC has an interactive conversation", EditorStyles.boldLabel);
            EditorGUILayout.EndHorizontal();
            if (hasConversation)
            {
                EditorWindowTools.StartIndentedSection();
                if (conversationTrigger == null)
                {
                    conversationTrigger = npcObject.AddComponent <ConversationTrigger>();
                }
                EditorGUILayout.HelpBox("Select the NPC's conversation and what event will trigger it. If the NPC will only engage in this conversation once, tick Once Only. Click Select NPC to further customize the Conversation Trigger in the inspector, such as setting conditions on when the conversation can occur.",
                                        string.IsNullOrEmpty(conversationTrigger.conversation) ? MessageType.Info : MessageType.None);
                conversationTrigger.conversation = DrawConversationPopup(conversationTrigger.conversation);
                conversationTrigger.once         = EditorGUILayout.Toggle("Once Only", conversationTrigger.once);
                conversationTrigger.trigger      = DrawTriggerPopup(conversationTrigger.trigger);
                if (GUILayout.Button("Select NPC", GUILayout.Width(100)))
                {
                    Selection.activeGameObject = npcObject;
                }
                EditorWindowTools.EndIndentedSection();
            }
            else
            {
                DestroyImmediate(conversationTrigger);
            }
            EditorWindowTools.EndIndentedSection();
            DrawNavigationButtons(true, true, false);
        }