Skip to main content

HitModifierEffect

A class in Root.Township, Alta.Impact.

Plays a stat upgrade visual effect between two places (the object, the hit target or the wielder) when an ImpactModifier modifies a hit. The server sends it to players in the chunk.

Constructors​

MemberWhat it is
HitModifierEffect()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

8 private and internal fields
MemberWhat it is
private Color effectColorColour passed to the effect.
private PooledObjectDefinition effectDefinitionPool definition of the StatUpgradeEffect to play.
private float effectDurationHow long the effect lasts.
private Transform localTargetTransform used when source or target is this object.
private float minimumEffectivenessToPlayHits below this effectiveness show no effect.
private HitModifierEffect.EffectPosition sourceWhere the effect starts: this object, the hit target or the wielder.
private MethodSyncStruct<HitModifierEffect.SyncHitArguments> syncHitSynced method that carries the effect to clients.
private HitModifierEffect.EffectPosition targetWhere the effect goes: this object, the hit target or the wielder.

Methods​

MemberWhat it is
override void Initialize()Sets up the synced method used to send the effect.
override void InitializeAsServer(SpawnData spawnData)Server: hooks OnModifiedHit on the ImpactModifier on this object.
2 private and internal methods
MemberWhat it is
private void PlayEffects(ImpactHitWithTool hit)Server: on a hit effective enough, plays the effect locally if not headless and sends it to the chunk.
private void SyncHit(IPlayer player, Stream stream, HitModifierEffect.SyncHitArguments arguments)Reads or writes the source and target entity IDs; on clients, finds them and plays the effect.