Skip to main content

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.

Constructors​

MemberWhat it is
TreeSpecies()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

18 private and internal fields
MemberWhat it is
private Material[] atlasedMaterialsAtlased leaf materials written by FixMaterials at build time.
private float breakThresholdMultiplierBacking field for BreakThresholdMultiplier, which scales how much force breaks tree connections.
private float damageMultiplierBacking field for DamageMultiplier.
private float distanceDistributionBacking field for DistanceDistribution, the radius chopping damage spreads over.
private ImpactDetectorSettings doneEffectBacking field for DoneEffect.
private float dropVelocityBacking field for DropVelocity, the random speed given to wedges and sticks dropped by chopping.
private ImpactDetectorSettings hitEffectBacking field for HitEffect.
private int imposterLodBacking field for ImposterLod. Defaults to 2.
private bool[] leafNeedsFixingPer leaf material, whether it was found in an atlas. Written by FixMaterials.
private Vector4[] leafOffsetScalePer leaf material, its atlas rect. Written by FixMaterials.
private Material modifiedMaterialA material set in the inspector. Nothing in the server build reads it.
private float oppositesThresholdBacking field for OppositesThreshold: combined progress of two opposite cut points that fells the section.
private Material[] pcLeafMaterialsBacking field for LeafMaterials, the unatlased leaf materials.
private PhysicalMaterial physicalMaterialBacking field for PhysicalMaterial.
private Distribution stickBacking field for Stick, the drop distribution for stick-type pieces.
private float totalFallSideThresholdBacking field for TotalFallSideThreshold: progress one cut point needs to fell the section once the total is past totalPercentThreshold.
private float totalPercentThresholdBacking field for TotalPercentThreshold: average cut progress at which a section can fall to its most cut side.
private Distribution wedgeBacking field for Wedge, the drop distribution for wedge-type pieces.

Properties​

MemberWhat 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​

MemberWhat 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: