protected override void Draw()
        {
            if (serializedObject == null)
            {
                return;
            }
            var counterIndexProperty         = serializedObject.FindProperty("m_counterIndex");
            var counterValueModeProperty     = serializedObject.FindProperty("m_counterValueMode");
            var requiredCounterValueProperty = serializedObject.FindProperty("m_requiredCounterValue");

            UnityEngine.Assertions.Assert.IsNotNull(counterIndexProperty, "Quest Machine: Internal error - m_counterIndex is null.");
            UnityEngine.Assertions.Assert.IsNotNull(counterValueModeProperty, "Quest Machine: Internal error - m_counterValueMode is null.");
            UnityEngine.Assertions.Assert.IsNotNull(requiredCounterValueProperty, "Quest Machine: Internal error - m_requiredCounterValue is null.");
            if (counterIndexProperty == null || counterValueModeProperty == null || requiredCounterValueProperty == null)
            {
                Debug.LogError("Quest Machine: Internal error in CounterQuestConditionEditor. Please contact the developer.");
                return;
            }
            EditorGUILayout.HelpBox("This condition requires that the value of a counter defined in your quest meets a criteria such as being at least a specific amount.", MessageType.None);
            QuestEditorUtility.EditorGUILayoutCounterNamePopup(counterIndexProperty, m_nameList);
            EditorGUILayout.PropertyField(counterValueModeProperty);
            EditorGUILayout.PropertyField(requiredCounterValueProperty, true);
            if (GUILayout.Button("Refresh Counter Names"))
            {
                m_nameList = QuestEditorUtility.GetCounterNames();
            }
        }
예제 #2
0
        protected override void Draw()
        {
            if (serializedObject == null)
            {
                return;
            }
            if (m_nameList == null)
            {
                m_nameList = QuestEditorUtility.GetCounterNames();
            }
            serializedObject.Update();
            var counterIndexProperty   = serializedObject.FindProperty("m_counterIndex");
            var operationProperty      = serializedObject.FindProperty("m_operation");
            var operationValueProperty = serializedObject.FindProperty("m_operationValue");
            var maxValueProperty       = serializedObject.FindProperty("m_maxValue");

            UnityEngine.Assertions.Assert.IsNotNull(counterIndexProperty, "Quest Machine: Internal error - m_counterIndex is null.");
            UnityEngine.Assertions.Assert.IsNotNull(operationProperty, "Quest Machine: Internal error - m_operation is null.");
            UnityEngine.Assertions.Assert.IsNotNull(operationValueProperty, "Quest Machine: Internal error - m_operationValue is null.");
            UnityEngine.Assertions.Assert.IsNotNull(maxValueProperty, "Quest Machine: Internal error - m_maxValue is null.");
            if (counterIndexProperty == null || operationProperty == null || operationValueProperty == null || maxValueProperty == null)
            {
                return;
            }
            QuestEditorUtility.EditorGUILayoutCounterNamePopup(counterIndexProperty, m_nameList);
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(operationProperty);
            if (EditorGUI.EndChangeCheck())
            {
                m_operationValueTooltip = null;
            }
            var operation = (SetCounterValueQuestAction.Operation)operationProperty.enumValueIndex;

            if (m_operationValueTooltip == null)
            {
                m_operationValueTooltip = GetOperationValueTooltip(operation);
            }
            EditorGUILayout.PropertyField(operationValueProperty, m_operationValueTooltip);
            if (operation == SetCounterValueQuestAction.Operation.Randomize)
            {
                EditorGUILayout.PropertyField(maxValueProperty);
            }
            serializedObject.ApplyModifiedProperties();
        }
        protected override void Draw()
        {
            if (serializedObject == null)
            {
                return;
            }
            EditorGUILayout.HelpBox("When this node becomes active, this condition starts a countdown using the counter defined in your quest. Make sure the counter value is set to your desired time before using this action. Every second, the counter value will decrease by one. If it reaches zero, the condition will be true.", MessageType.None);
            var counterIndexProperty = serializedObject.FindProperty("m_counterIndex");

            UnityEngine.Assertions.Assert.IsNotNull(counterIndexProperty, "Quest Machine: Internal error - m_counterIndex is null.");
            if (counterIndexProperty == null)
            {
                return;
            }
            QuestEditorUtility.EditorGUILayoutCounterNamePopup(counterIndexProperty, m_nameList);
            if (GUILayout.Button("Refresh Counter Names"))
            {
                m_nameList = QuestEditorUtility.GetCounterNames();
            }
        }