BasicChiselable
A class in Root.Township, Features.Gameplay.Activities.Carpentry.
Simple chisel target with a health value. The server takes off chisel damage and, when health runs out, fires its broken events on the server and on clients in the chunk.
- Listed in ATT, Features and other game namespaces
- Inherits or implements
NetworkEntityBehaviour,IChiselable - Derived types
ChiselableSurfaceDock
Constructors
| Member | What it is |
|---|---|
BasicChiselable() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|---|
private AltaEvent brokenClient | Event fired on clients when the object breaks. |
private AltaEvent brokenServer | Event fired on the server when the object breaks. |
private float health | Damage left before the object breaks. Default 1. Not synced or saved. |
private MethodSync sync | Method sync used to send the break to clients. |
private FloatEvent tookDamage | Event fired with the damage amount on each hit. |
Properties
| Member | What it is |
|---|---|
bool IsEnabled { get; set; } | IChiselable flag, default true. ReceiveDamage checks the component's enabled instead, not this. |
Methods
| Member | What it is |
|---|---|
virtual void GetDirectionLeniency(ref float directionMultiplier) | Virtual hook to change the chisel direction multiplier. Does nothing here. |
virtual float GetHitMultiplier(Vector3 hitDirection) | Virtual hook for a per-direction damage multiplier. Returns 1 here. |
override void Initialize() | Creates the break method sync on SyncB. |
virtual void ReceiveDamage(float damage, Vector3 position, Vector3 direction, ChiselingTool tool, Collider hitCollider) | Fires tookDamage on both sides; on the server, takes damage off health and breaks the object at zero. |
protected virtual void OnBrokenServer(float damage, Vector3 position, Vector3 direction, ChiselingTool tool, Collider hitCollider) | Server: tells clients in the chunk the object broke and fires brokenServer. Override to add behaviour. |
protected virtual bool OnDamageTakenServer(float damage, Vector3 position, Vector3 direction, ChiselingTool tool, Collider hitCollider) | Server: virtual check run before damage is applied; return false to ignore the hit. Returns true here. |