TreeSpecies
A class in Root.Township, Alta.Woodcutting.
A hashed asset for one kind of tree: its wood material, how chopping damage spreads, when the trunk falls and what drops when pieces are chopped. Stored under Woodcutting/TreeSpecies.
- Listed in Crafting and making
- Inherits or implements
HashedGeneralValue<TreeSpecies> - Derived types
TreeSpecies,TreeSpecies.Create - Nested types
Create - Attributes
HashedPath - Documented in Farming, woodcutting and carpentry
Constructors
| Member | What it is |
|---|---|
TreeSpecies() | Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets. |
Fields
18 private and internal fields
| Member | What it is |
|---|---|
private Material[] atlasedMaterials | Atlased leaf materials written by FixMaterials at build time. |
private float breakThresholdMultiplier | Backing field for BreakThresholdMultiplier, which scales how much force breaks tree connections. |
private float damageMultiplier | Backing field for DamageMultiplier. |
private float distanceDistribution | Backing field for DistanceDistribution, the radius chopping damage spreads over. |
private ImpactDetectorSettings doneEffect | Backing field for DoneEffect. |
private float dropVelocity | Backing field for DropVelocity, the random speed given to wedges and sticks dropped by chopping. |
private ImpactDetectorSettings hitEffect | Backing field for HitEffect. |
private int imposterLod | Backing field for ImposterLod. Defaults to 2. |
private bool[] leafNeedsFixing | Per leaf material, whether it was found in an atlas. Written by FixMaterials. |
private Vector4[] leafOffsetScale | Per leaf material, its atlas rect. Written by FixMaterials. |
private Material modifiedMaterial | A material set in the inspector. Nothing in the server build reads it. |
private float oppositesThreshold | Backing field for OppositesThreshold: combined progress of two opposite cut points that fells the section. |
private Material[] pcLeafMaterials | Backing field for LeafMaterials, the unatlased leaf materials. |
private PhysicalMaterial physicalMaterial | Backing field for PhysicalMaterial. |
private Distribution stick | Backing field for Stick, the drop distribution for stick-type pieces. |
private float totalFallSideThreshold | Backing field for TotalFallSideThreshold: progress one cut point needs to fell the section once the total is past totalPercentThreshold. |
private float totalPercentThreshold | Backing field for TotalPercentThreshold: average cut progress at which a section can fall to its most cut side. |
private Distribution wedge | Backing field for Wedge, the drop distribution for wedge-type pieces. |
Properties
| Member | What it is |
|---|---|
float BreakThresholdMultiplier { get; } | Multiplies the impulse needed to break tree branches off when something hits them. |
float DamageMultiplier { get; } | Divides chopping damage, so a higher value means a tougher tree. Also used as the tree's max health. |
float DistanceDistribution { get; } | Radius around a hit over which chopping damage spreads to nearby cut points. |
ImpactDetectorSettings DoneEffect { get; } | Impact effect used when a section is chopped through. |
float DropVelocity { get; } | Random velocity (and spin) given to wedges or sticks dropped from a chop. |
ImpactDetectorSettings HitEffect { get; } | Impact effect used when the tree is hit. |
int ImposterLod { get; } | LOD index at which the tree switches to an imposter. |
MaterialRect[] LeafMaterialRects { get; } | Leaf materials as atlas rects, using the baked atlas data if present. |
Material[] LeafMaterials { get; } | The tree's leaf materials before atlasing. |
float OppositesThreshold { get; } | If two opposite cut points add up to more than this, the section is chopped through. |
PhysicalMaterial PhysicalMaterial { get; } | The wood material, which sets hardness, renderer material and the material of dropped pieces. |
Distribution Stick { get; } | Distribution of prefabs dropped when a stick-type piece is chopped. |
float TotalFallSideThreshold { get; } | Once TotalPercentThreshold is passed, the first cut point past this progress chops the section and sets the fall side. |
float TotalPercentThreshold { get; } | Average cut progress across a section's cut points needed before TotalFallSideThreshold is checked. |
Distribution Wedge { get; } | Distribution of prefabs (wood wedges) dropped when a section is chopped. |
Methods
| Member | What it is |
|---|---|
void FixMaterials(IEnumerable<AtlasDefinition> definitions) | Editor bake: finds the atlased version of each leaf material and stores its rect. |
Used in
Members of other types that take, return or hold a TreeSpecies:
PresetTree.GenerateRunTimeTree, PresetTree.GenerateRunTimeTreeWithoutParent, PresetTree.SpawnAndInitWoodcutTree, PresetTree.species, PresetTree.Species, TreeSpawner.species, WoodcutTree.species, WoodcutTree.Species, WoodcutTreeSaveData.species, WoodcutTreeSaveData2.species, WoodcutPooledObject.SetSpecies.