Class BuffAspect
Aspect of an entity that understands buffs.
public class BuffAspect : EntityAspect, IAspect<Entity>, IAspect
- Inheritance
-
BaseAspect<Entity>BuffAspect
- Implements
-
IAspect<Entity>
- Inherited Members
- Extension Methods
Constructors
BuffAspect(EntityAspect, bool)
Initializes a new instance of the EntityAspect class with another aspect.
public BuffAspect(EntityAspect aspect, bool strict = true)
Parameters
aspectEntityAspectThe aspect to copy from.
strictboolIf true, the aspect will throw an exception if the entity is null.
Exceptions
- ArgumentNullException
Thrown when the entity of the aspect is null.
BuffAspect(Entity, bool)
Initializes a new instance of the EntityAspect class with the specified entity.
public BuffAspect(Entity entity, bool strict = true)
Parameters
entityEntityThe entity to associate with this aspect.
strictboolIf true, the aspect will throw an exception if the entity is null.
Exceptions
- ArgumentNullException
Thrown when the entity is null.
Properties
Queries
public static BuffQueries Queries { get; }
Property Value
Methods
ApplyBuff(Entity, PrefabGUID, out Entity, float, bool)
Applies a buff to an entity with optional duration and persistence settings.
public static bool ApplyBuff(Entity target, PrefabGUID buff, out Entity buffEntity, float duration = 0, bool tryPersistThroughDeath = false)
Parameters
targetEntityEntity to apply the buff to.
buffPrefabGUIDThe PrefabGUID of the buff to apply.
buffEntityEntityOutput parameter that receives the created buff entity.
durationfloatDuration of the buff in seconds. 0 for infinite duration.
tryPersistThroughDeathboolIf true, the buff will attempt to persist through death.
Returns
- bool
True if the buff was successfully applied, false otherwise.
ApplyCosmetic(Entity, PrefabGUID)
Applies a cosmetic buff to an entity and removes gameplay-related components.
public static void ApplyCosmetic(Entity entity, PrefabGUID visual)
Parameters
entityEntityThe entity to apply the cosmetic to.
visualPrefabGUIDThe PrefabGUID of the cosmetic buff to apply.
CreateAndApply(Entity, out BuffAspect?, float, bool)
public bool CreateAndApply(Entity target, out BuffAspect? buffAspect, float duration = 0, bool tryPersistThroughDeath = false)
Parameters
targetEntitybuffAspectBuffAspectdurationfloattryPersistThroughDeathbool
Returns
HasBuff(Entity, PrefabGUID)
Checks if an entity has a specific buff.
public static bool HasBuff(Entity entity, PrefabGUID buff)
Parameters
entityEntityThe entity to check for the buff.
buffPrefabGUIDThe PrefabGUID of the buff to check for.
Returns
- bool
True if the entity has the specified buff, false otherwise.
Is(Entity)
public static bool Is(Entity entity)
Parameters
entityEntity
Returns
Modify(BuffModificationTypes, bool)
Modifies a buff entity with specified modification types.
public void Modify(BuffModificationTypes buffModificationTypes, bool overwrite = false)
Parameters
buffModificationTypesBuffModificationTypesThe types of modifications to apply.
overwriteboolIf true, clears existing modifications before applying new ones.
Qualifies(Entity)
Checks if the entity qualifies for this aspect.
public override bool Qualifies(Entity entity)
Parameters
entityEntity
Returns
- bool
Returns true if the entity qualifies, otherwise false.
RemoveBuff(Entity, PrefabGUID)
Removes a specific buff from an entity.
public static void RemoveBuff(Entity entity, PrefabGUID guid)
Parameters
entityEntityThe entity to remove the buff from.
guidPrefabGUIDThe PrefabGUID of the buff to remove.