An abstract class in Root.Township, Alta.Carpentry.
Base for one chiselable piece of a timber block in carpentry. Starts disabled; a TimberBlock stage enables, saves and syncs its pieces.
Constructors
| Member | What it is |
|---|
protected TimberPieceBase() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
2 private and internal fields
| Member | What it is |
|---|
private PooledObjectDefinition hittinEffect | Pooled effect spawned at the piece on clients when it takes damage. |
private SoundEffectSet hittingSound | Sound set played at the piece on clients when it takes damage. |
Properties
| Member | What it is |
|---|
int Index { get; set; } | The piece's index within its stage. |
bool IsDone { get; private set; } | Set by MarkIsDone once the piece is finished. |
bool IsModified { get; protected set; } | Whether the piece has been carved or turned away from its starting state. |
Player LastHittingPlayerController { get; protected set; } | The player who last hit this piece. |
abstract MeshFilter MeshFilter { get; } | The mesh filter that shows the piece. |
abstract float Progress { get; set; } | How far the piece has been carved, as set by the subclass. |
override bool TriggerHaptics { get; } | Haptics only fire while the piece is enabled. |
Methods
| Member | What it is |
|---|
abstract void Load(PieceSaveData data) | Restores the piece from its save data. |
void MarkIsDone() | Marks the piece finished and hides its game object. |
override void ReceiveDamage(float damage, Vector3 position, Vector3 direction, ChiselingTool tool, Collider hitCollider) | Applies a chisel hit, then plays the hit effect and sound (not on headless). |
abstract void Rotate(bool isInversedUp) | Turns the piece to match the block's orientation. |
abstract PieceSaveData Save() | Returns the piece's save data. |
abstract void Serialize(Stream stream, bool isWritingFull) | Writes or reads the piece's state on a network stream, fully or as a change. |
protected virtual void Awake() | Disables the piece until its stage turns it on. |
Used in
Members of other types that take, return or hold a TimberPieceBase:
RecipePlacer.UpdatePiece, TimberBlock.CallPieceEffect, TimberBlock.GetPiece, TimberBlock.OuterStage.CheckDone, TimberBlock.Stage.CheckDone, TimberBlock.Stage.GetPiece, TimberBlock.Stage.pieces, TimberBlock.Stage.Pieces, TimberBlock.Stage.RunOperationOnPieces, TimberPieceDelegate.BeginInvoke, TimberPieceDelegate.Invoke.