Gameplay.Attribute.AttributePool.GetAttribute C# (CSharp) Method

GetAttribute() public method

public GetAttribute ( AttributeType targetAttributeType ) : Attribute
targetAttributeType AttributeType
return Attribute
        public Attribute GetAttribute(AttributeType targetAttributeType)
        {
            if (!attributes.ContainsKey(targetAttributeType))
            {
                Debug.Log("Can't found any attribute of type: " + targetAttributeType, this);
                return null;
            }
            return attributes[targetAttributeType];
        }

Usage Example

        public override void ChangeValue(float targetValue)
        {
            Attribute armor = AttributePool.GetAttribute(AttributeType.Armor);

            if (armor != null)
            {
                targetValue += armor.CurrentValue;
            }

            base.ChangeValue(targetValue);
        }