AnimationPart
A class in Root.Township, the global namespace.
One moving piece in a building animation: it slides in from an offset to its final transform, with optional sound and effect overrides.
- Listed in Global namespace: A to B
Constructors
| Member | What it is |
|---|---|
AnimationPart(Transform transform, Vector3 moveDirection, float distance) | Creates an AnimationPart from transform, moveDirection and distance. |
Fields
8 private and internal fields
| Member | What it is |
|---|---|
private float distance | How far from its final position the part starts. Exposed as Distance. |
private Vector3 moveDirection | Local direction the part moves in from, scaled by distance. Exposed as MoveDirection. |
private PooledObjectDefinition overrideEffectOnAppear | Pooled effect spawned when this part appears, instead of the building animation's default. |
private PooledObjectDefinition overrideEffectOnPosition | Pooled effect spawned when this part reaches its final position. |
private SoundEffect overrideSoundOnAppear | Sound played when this part appears, instead of the default. |
private SoundEffect overrideSoundOnPosition | Sound played when this part reaches its final position. |
private float repairBoxScale | Multiplier on the part's final scale used by RepairBox. |
private Transform transform | The transform being animated. |
Properties
| Member | What it is |
|---|---|
float Distance { get; set; } | How far away the piece starts. |
Vector3 FinalPosition { get; private set; } | World position the piece ends at. |
Quaternion FinalRotation { get; private set; } | World rotation the piece ends at. |
Vector3 FinalScale { get; private set; } | Local scale the piece ends at. |
Vector3 MoveDirection { get; set; } | Local direction the piece comes in from. |
PooledObjectDefinition OverrideEffectOnAppear { get; set; } | Effect to spawn when the piece appears instead of the default. |
PooledObjectDefinition OverrideEffectOnPosition { get; set; } | Effect to spawn when the piece reaches its place instead of the default. |
SoundEffect OverrideSoundOnAppear { get; set; } | Sound to play when the piece appears instead of the default. |
SoundEffect OverrideSoundOnPosition { get; set; } | Sound to play when the piece reaches its place instead of the default. |
float RepairBoxScale { get; set; } | Scale of the piece shown in a repair box, as a fraction of its final scale. |
Vector3 StartPosition { get; private set; } | Where the piece starts: final position plus the move direction times the distance. |
Transform Transform { get; } | The piece being animated. |
Methods
| Member | What it is |
|---|---|
void RecalculatePositions() | Takes the transform's current pose as final and works out the start position. |
Used in
Members of other types that take, return or hold a AnimationPart: