Пример #1
0
        protected override InitState InitPropertyImpl(MightySerializedField serializedField, AnimatorParameterAttribute attribute)
        {
            var property = serializedField.Property;

            if (property.propertyType != SerializedPropertyType.Integer)
            {
                return(new InitState(false, "\"" + property.displayName + "\" should be of type int"));
            }

            var name = attribute.ParameterName;

            if (attribute.NameAsCallback && serializedField.GetValueFromMember(attribute.Target, name, out string nameValue))
            {
                name = nameValue;
            }

            property.intValue = Animator.StringToHash(name);
            return(new InitState(true));
        }
Пример #2
0
        protected override InitState InitPropertyImpl(MightySerializedField serializedField, LayerNameAttribute attribute)
        {
            var property        = serializedField.Property;
            var attributeTarget = property.GetAttributeTarget <LayerNameAttribute>();

            if (property.propertyType != SerializedPropertyType.Integer)
            {
                return(new InitState(false, "\"" + property.displayName + "\" should be of type int"));
            }

            var name = attribute.LayerName;

            if (attribute.NameAsCallback && serializedField.GetValueFromMember(attributeTarget, name, out string nameValue))
            {
                name = nameValue;
            }

            property.intValue = LayerMask.NameToLayer(name);;
            return(new InitState(true));
        }