Beispiel #1
0
        int AddModifier(AttributeModifierConfig modifier_config, FixPoint modifier_value)
        {
            AttributeModifier attribute_modifier = RecyclableObject.Create <AttributeModifier>();

            attribute_modifier.Construct(GetLogicWorld().GetAttributeModifierIDGenerator().GenID(), modifier_config.m_attribute_category, modifier_value);

            EffectDefinitionComponent definition_component = ((Effect)ParentObject).GetDefinitionComponent();
            EntityManager             entity_manager       = GetLogicWorld().GetEntityManager();
            Entity    owner_entity = entity_manager.GetObject(definition_component.TargetEntityID);
            Attribute attribute    = EntityUtil.GetAttribute(owner_entity, modifier_config.m_attribute_id);

            if (attribute == null)
            {
                return(0);
            }
            attribute.AddModifier(attribute_modifier);
            return(attribute_modifier.ID);
        }
Beispiel #2
0
        FixPoint GetModifierValueOfOneCategory(int category)
        {
            FixPoint value = FixPoint.Zero;

            if (m_modifiers == null)
            {
                return(value);
            }
            var enumerator = m_modifiers.GetEnumerator();

            while (enumerator.MoveNext())
            {
                AttributeModifier modifier = enumerator.Current.Value;
                if (modifier.Category == category)
                {
                    FixPoint modifier_value = modifier.Value;
                    value += modifier_value;
                }
            }
            return(value);
        }