Skip to main content

Chiselable

A class in Root.Township, Alta.Carpentry.

Something a chisel can carve. Passes chisel hits on to events; subclasses decide direction rules.

Constructors​

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

Fields​

1 private and internal field
MemberWhat it is
private FloatEvent tookDamageEvent raised with the damage whenever a chisel hits this.

Properties​

MemberWhat it is
virtual bool IsEnabled { get; set; }Whether chisels can hit it right now.
virtual bool TriggerHaptics { get; }Whether a chisel near it vibrates the controller. False by default.

Events​

MemberWhat it is
event ChiselHit onHitRaised on every chisel hit with damage, position, direction, tool and collider.

Methods​

MemberWhat it is
static IChiselable GetChiseleable(Collider collider)Finds the chiselable on a collider or its attached rigidbody, or null.
virtual void GetDirectionLeniency(ref float directionMultiplier)Subclass: can adjust the direction multiplier. Does nothing by default.
virtual float GetHitMultiplier(Vector3 hitDirection)How well a hit direction lines up, from 0 to 1. Always 1 by default.
virtual void ReceiveDamage(float damage, Vector3 position, Vector3 direction, ChiselingTool tool, Collider hitCollider)Takes a chisel hit and raises the damage and hit events.

Used in​

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