Пример #1
0
        void CalculateLocomotorSpeedrate()
        {
            Entity    owner_entity = GetOwnerEntity();
            Attribute attribute    = EntityUtil.GetAttribute(owner_entity, PredefinedAttribute.MaxSpeed);

            if (attribute == null)
            {
                return;
            }
            m_locomotor_speed_rate = m_current_max_speed / attribute.BaseValue;
        }
Пример #2
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);
        }
Пример #3
0
        public override void Unapply()
        {
            if (m_modifier_ids == null)
            {
                return;
            }
            EffectDefinitionComponent definition_component = ((Effect)ParentObject).GetDefinitionComponent();
            EntityManager             entity_manager       = GetLogicWorld().GetEntityManager();
            Entity owner_entity = entity_manager.GetObject(definition_component.TargetEntityID);

            for (int i = 0; i < m_modifier_ids.Length; ++i)
            {
                Attribute attribute = EntityUtil.GetAttribute(owner_entity, m_modefier_configs[i].m_attribute_id);
                if (attribute != null)
                {
                    attribute.RemoveModifier(m_modifier_ids[i]);
                    m_modifier_ids[i] = 0;
                }
            }
        }