Exemple #1
0
        private bool GetConditionAttributeResult(MMFEnumConditionAttribute enumConditionAttribute, SerializedProperty property)
        {
            bool               enabled             = true;
            string             propertyPath        = property.propertyPath;
            string             conditionPath       = propertyPath.Replace(property.name, enumConditionAttribute.ConditionEnum);
            SerializedProperty sourcePropertyValue = property.serializedObject.FindProperty(conditionPath);

            if ((sourcePropertyValue != null) && (sourcePropertyValue.propertyType == SerializedPropertyType.Enum))
            {
                int currentEnum = sourcePropertyValue.enumValueIndex;
                enabled = enumConditionAttribute.ContainsBitFlag(currentEnum);
            }
            else
            {
                Debug.LogWarning("No matching boolean found for ConditionAttribute in object: " + enumConditionAttribute.ConditionEnum);
            }

            return(enabled);
        }