Skip to main content

WoodcutPointData

A class in Root.Township, the global namespace.

One damage point on a woodcut tree: a local position and how far it has been chopped (0 to 1). Synced as a child of the tree, saved with it, and drives the tree's damage colouring.

Constructors​

MemberWhat it is
WoodcutPointData()Creates a WoodcutPointData with default values.

Fields​

MemberWhat it is
Vector3 positionBacking field for Position, set in the inspector.
2 private and internal fields
MemberWhat it is
private bool hasChangedSinceLastWriteSet when progress changes; cleared after the point is written to a sync stream.
private float progressHow far this cut point has been chopped, 0 to 1; saved and synced. Backing field for Progress.

Properties​

MemberWhat it is
NetworkEntity Entity { get; set; }The tree entity this point belongs to.
Vector3 Position { get; }The point's local position on the tree.
float Progress { get; set; }How chopped this point is, from 0 to 1. Setting it raises Changed and marks it for sync.

Events​

MemberWhat it is
event Action<WoodcutPointData> ChangedRaised when Progress changes.

Methods​

MemberWhat it is
void CopyFrom(WoodcutPointData other)Copies another point's progress.
void Initialize(ChildSyncableCollectionBase<WoodcutPointData> collection)Does nothing.
void InitializeAsServer(SpawnData spawnData)Does nothing.
bool IsEqual(WoodcutPointData other)True if both points have the same progress.
bool IsNeedingSync()True if progress changed since it was last written to the network.
void Sync(IPlayer player, Stream stream)Writes or reads the progress (7 bits). Clients apply what they read.
void TakeDamage(float damage)Server: adds the damage to the progress, clamped to 1.
2 private and internal methods
MemberWhat it is
private void OnChanged()Marks the point as needing sync and raises Changed.
private void OnValidate()Raises the change event when edited in the inspector.

Used in​

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