DestroyableStaticObject
A class in Root.Township, Alta.Networking.
A modifiable static world object (such as a breakable wall) that takes hit damage while modified and reverts to unmodified when its health runs out. Server only.
- Listed in Networking and servers
- Inherits or implements
ModifiableStaticObject - Documented in Static objects
Constructors
| Member | What it is |
|---|---|
DestroyableStaticObject() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|---|
private float currentHealth | Health left before the object reverts. |
private ImpactDetector[] detectors | Impact detectors that pass hits to Hit. |
private Dictionary<ImpactType, float> impactTypeMultipliers | Damage multiplier per impact type, built from multipliers. |
private float modifiedHealth | Health the object gets each time it becomes modified. |
private AttackTypeMultiplier[] multipliers | Damage multipliers per attack type. |
Methods
| Member | What it is |
|---|---|
protected override void OnValidate() | Editor: fills detectors from child impact detectors if empty. |
protected override void Start() | Waits for ModifiableStaticManager to finish initializing before running Initialize. |
3 private and internal methods
| Member | What it is |
|---|---|
private void Hit(ImpactHit impact) | Server: applies impact damage, scaled by attack type and armour multipliers, and unmodifies the object at 0 health. |
private void Initialize(NetworkEntity entity = null) | Server: hooks the impact detectors and modified event and loads the attack type multipliers, once the static manager is ready. |
private void Modified(ModifiableStaticObject self) | Resets health to modifiedHealth when the object becomes modified. |