Skip to main content

PlayerEffectManager

A class in Root.Township, the global namespace.

Client: shows smoke, burn, light and stat buff or debuff effects on a player's body points from their heat points and stats. It destroys itself on headless servers.

Constructors​

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

Fields​

15 private and internal fields
MemberWhat it is
private PooledObjectDefinition burnEffectPooled effect shown when a body point is hot enough to burn.
private float burnMinThresholdTemperature at which a body point starts burning.
private PlayerEffectManager.EffectPosition[] effectPositionsThe body points that can show effects, each tied to a heat point.
private Dictionary<HeatPoint, PlayerEffectManager.EffectPointStatus> heatPointStatusEffect state for each heat point.
private float[] levelsThe smoke and burn temperature thresholds, in that order.
private PlayerEffectManager.LightEffect lightEffectThe glow light shown while any body point burns.
private PooledObjectDefinition lightEffectDefinitionPooled light used for the burning glow.
private Transform lightEffectParentTransform the glow light is spawned under.
private AnimationCurve lightIntensityByBurningPointsCurve from the number of burning body points to light intensity.
private PooledObjectDefinition smokeEffectPooled effect shown when a body point is hot enough to smoke.
private float smokeMinThresholdTemperature at which a body point starts smoking.
private StatEffectsDefinition statEffectsDefinitionAsset listing the stats that have buff and debuff effects.
private StatManager statManagerThe player's stats, watched for buffs and debuffs.
private AnimationCurve temperatureToScaleMultiplierCurve from temperature to burn effect size.
private PlayerController thisPlayerThe player this manager belongs to.

Properties​

MemberWhat it is
IEnumerable<StatEffectHolder> StatEffects { get; }The stat effects listed in statEffectsDefinition.

Methods​

7 private and internal methods
MemberWhat it is
private void ActivateStatEffect(StatDefinition definition, bool isBuff, bool isActive)Turns a stat's buff or debuff effect on or off at every body point that shows stat effects.
private void RunStatEffectCommand(StatDefinition definition, bool isBuff, Action<PlayerEffectManager.EffectApplication> command)Runs an action on the buff or debuff effect for a stat at every body point that shows stat effects.
private void SetLocalPlayer()Sets up each body point and the stat effect watchers once the player is known to be local or remote.
private bool SetupLevels()Inspector helper that keeps levels equal to the smoke and burn thresholds.
private void Start()Destroys the component on headless servers, otherwise sets up now or once linked to a network player.
private void UpdateLightEffects()Spawns or updates the glow light based on how many body points are burning, and releases it when none are.
private void UpdateStatEffect(StatDefinition definition, bool isBuff, float size)Resizes a stat's buff or debuff effect at every body point that shows stat effects.

Used in​

Members of other types that take, return or hold a PlayerEffectManager: