Exemple #1
0
        private void ApplyAuraEffect(IHasAttributes target, AuraEffect auraEffect)
        {
            var attributeEffect = auraEffect.AttributeEffect;
            var attributeName   = attributeEffect.AffectedAttributeName;

            if (!target.HasAttribute(attributeName))
            {
                return;
            }

            target.GetAttribute(attributeName).AddAttributeEffect(attributeEffect);
            _affectedAuraTargets.Add(target);
        }
 public static ICommonAttribute GetAttribute(this IHasAttributes hasAttributes, IHasType attributeHasType, bool throwExceptionIfNotFound = false)
 {
     return(hasAttributes.GetAttribute(attributeHasType.Type, throwExceptionIfNotFound));
 }
 public static ICommonAttribute GetAttribute <TAttribute>(this IHasAttributes hasAttributes, bool throwExceptionIfNotFound = false) where TAttribute : Attribute
 {
     return(hasAttributes.GetAttribute(typeof(TAttribute), throwExceptionIfNotFound));
 }
 public static bool TryGetAttribute(this IHasAttributes hasAttributes, string attributeTypeFullName, out ICommonAttribute foundCommonAttribute)
 {
     return((foundCommonAttribute = hasAttributes.GetAttribute(attributeTypeFullName)) != null);
 }
 public static bool TryGetAttribute(this IHasAttributes hasAttributes, IHasType attributeHasType, out ICommonAttribute foundCommonAttribute)
 {
     return((foundCommonAttribute = hasAttributes.GetAttribute(attributeHasType)) != null);
 }
 public static bool TryGetAttribute <TAttribute>(this IHasAttributes hasAttributes, out ICommonAttribute foundCommonAttribute) where TAttribute : Attribute
 {
     return((foundCommonAttribute = hasAttributes.GetAttribute <TAttribute>()) != null);
 }
 public static Attribute GetCastedAttribute(this IHasAttributes hasAttributes, Type attributeType, bool throwExceptionIfNotFound = false)
 {
     return(hasAttributes.GetAttribute(attributeType, throwExceptionIfNotFound)?.Reflection);
 }
 public static TAttribute GetCastedAttribute <TAttribute>(this IHasAttributes hasAttributes, bool throwExceptionIfNotFound = false) where TAttribute : Attribute
 {
     return(hasAttributes.GetAttribute <TAttribute>(throwExceptionIfNotFound)?.Reflection as TAttribute);
 }
 public static bool TryGetCastedAttribute <TAttribute>(this IHasAttributes hasAttributes, out TAttribute foundAttribute) where TAttribute : Attribute
 {
     return((foundAttribute = hasAttributes.GetAttribute <TAttribute>()?.Reflection as TAttribute) != null);
 }