コード例 #1
0
    void DisplayAITriggers(SerializedProperty _property, int _index)
    {
        //trigger
        var triggerName   = _property.FindPropertyRelative("triggerName");
        var triggerType   = _property.FindPropertyRelative("triggerType");
        var eventLoadType = _property.FindPropertyRelative("eventLoadType");
        var useType       = _property.FindPropertyRelative("useType");
        var amount        = _property.FindPropertyRelative("amount");
        var detectZoneInd = _property.FindPropertyRelative("detectZoneInd");
        var events        = _property.FindPropertyRelative("events");


        //valueamount
        var engineValueManager = _property.FindPropertyRelative("engineValueManager");
        var valueSelection     = _property.FindPropertyRelative("valueSelection");
        var valueOption        = _property.FindPropertyRelative("valueOption");
        var comparedValue      = _property.FindPropertyRelative("comparedValue");

        triggerName.stringValue = triggerType.enumNames[triggerType.enumValueIndex] + " | ";
        var detectNames = source.GetDetectZoneNames();

        if (triggerType.enumValueIndex != 3)
        {
            if (detectNames.Length > 0)
            {
                triggerName.stringValue += detectNames[detectZoneInd.intValue];
            }
        }

        EditorGUILayout.PropertyField(triggerType);
        EditorGUILayout.PropertyField(eventLoadType);
        EditorGUILayout.PropertyField(useType);

        if (useType.enumValueIndex == 1)
        {
            EditorGUILayout.PropertyField(amount);
        }
        if (amount.intValue < 1)
        {
            amount.intValue = 1;
        }

        //detect zone
        if (triggerType.enumValueIndex != 3)
        {
            detectZoneInd.intValue = EditorGUILayout.Popup("Detect Zone To Use", detectZoneInd.intValue, detectNames);
        }
        else
        {
            //value Amount
            EditorGUILayout.PropertyField(engineValueManager);
            var man = engineValueManager.GetRootValue <EngineValueDataManager>();
            if (man)
            {
                valueSelection.EngineValueSelectionField(engineValueManager);
                EditorGUILayout.PropertyField(valueOption);
                EditorGUILayout.PropertyField(comparedValue);

                triggerName.stringValue += " | " + System.Enum.GetNames(typeof(UnitAITrigger.ValueOptions))[valueOption.enumValueIndex]
                                           + " | " + comparedValue.floatValue;
            }
        }
        events.ArrayFieldButtons("Event", true, true, true, true, DisplayAIEvents);
    }