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
| Member | What it is |
|---|
WoodcutPointData() | Creates a WoodcutPointData with default values. |
Fields
| Member | What it is |
|---|
Vector3 position | Backing field for Position, set in the inspector. |
2 private and internal fields
| Member | What it is |
|---|
private bool hasChangedSinceLastWrite | Set when progress changes; cleared after the point is written to a sync stream. |
private float progress | How far this cut point has been chopped, 0 to 1; saved and synced. Backing field for Progress. |
Properties
| Member | What 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
| Member | What it is |
|---|
event Action<WoodcutPointData> Changed | Raised when Progress changes. |
Methods
| Member | What 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
| Member | What 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: