Skip to main content

EffectArea

A class in Root.Township, Alta.Alchemy.

Trigger volume that applies a liquid's effect to health objects while they are inside it and removes it when they leave. Server only; on clients it turns itself off on the first trigger.

Constructors​

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

Fields​

3 private and internal fields
MemberWhat it is
private Dictionary<Collider, EffectHandler> affectingColliders inside the area and their effect handlers.
private LiquidDefinition effectThe LiquidDefinition whose effect data is applied.
private float strengthStrength to apply on entry (and remove on exit).

Methods​

MemberWhat it is
protected virtual void EnterObject(EffectHandler handler)Applies the liquid's effect at strength to the handler that entered.
protected virtual EffectHandler GetHandler(Collider other)Finds the EffectHandler of the collider's ImpactDetector health target, or null.
protected virtual void LeaveObject(EffectHandler handler)Applies the effect at negative strength to undo it.
3 private and internal methods
MemberWhat it is
private void OnDisable()Undoes the effect on everything still inside and clears the list.
private void OnTriggerEnter(Collider other)Server: tracks the collider and applies the effect. Client: disables the component.
private void OnTriggerExit(Collider other)Undoes the effect on a tracked collider and stops tracking it.