HarvesterTreeInstance
Introduction
The HarvesterTreeInstance is a class that represents a single tree in a Unity scene that is to be harvested. It stores information about the tree such as its position, rotation, and scale, as well as the tree’s health, harvest progress, and whether it has been fully harvested. It is used by the Harvester system to manage the harvesting of trees in the scene. The class also provides methods to update the tree’s state based on harvesting progress, and to reset the tree to its initial state once it has been fully harvested. Overall, the HarvesterTreeInstance plays a crucial role in the harvesting process, helping to keep track of each individual tree and manage its harvesting progress.
Overview
The HarvesterTreeInstance
class represents a tree instance on a terrain in Unity. It stores information about the position, size, rotation, color, and prototype index of the tree, as well as some additional properties.
Constructors
The HarvesterTreeInstance
class does not have any constructors.
Methods
The HarvesterTreeInstance
class does not have any methods.
Properties
Property | Type | Description |
---|---|---|
position |
Vector3 |
The position of the tree. |
widthScale |
float |
The width scale of this instance (compared to the prototype’s size). |
heightScale |
float |
The height scale of this instance (compared to the prototype’s size). |
rotation |
float |
Read-only. The rotation of the tree on the X-Z plane (in radians). |
color |
Color32 |
The color of this instance. |
lightmapColor |
Color32 |
The lightmap color calculated for this instance. |
prototypeIndex |
int |
The index of this instance in the TerrainData.treePrototypes array. |
terrainInstance |
string |
A string representing the terrain instance that this tree is on. |
terrainInstanceName |
string |
The name of the terrain instance that this tree is on. |
terrainInstanceId |
int |
The ID of the terrain instance that this tree is on. |
harvestingRestoreTime |
float |
The amount of time it takes for the tree to restore itself after being harvested. |
Events
The HarvesterTreeInstance
class does not have any events.
Unity Usage
The HarvesterTreeInstance
class is not part of the Unity API and can be used in any C# script in a Unity project. It is typically used in conjunction with the TerrainData
class and the TreeInstance
structure to manipulate trees on a terrain.