Skip to main content

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.

Constructors​

MemberWhat it is
AnimationPart(Transform transform, Vector3 moveDirection, float distance)Creates an AnimationPart from transform, moveDirection and distance.

Fields​

8 private and internal fields
MemberWhat it is
private float distanceHow far from its final position the part starts. Exposed as Distance.
private Vector3 moveDirectionLocal direction the part moves in from, scaled by distance. Exposed as MoveDirection.
private PooledObjectDefinition overrideEffectOnAppearPooled effect spawned when this part appears, instead of the building animation's default.
private PooledObjectDefinition overrideEffectOnPositionPooled effect spawned when this part reaches its final position.
private SoundEffect overrideSoundOnAppearSound played when this part appears, instead of the default.
private SoundEffect overrideSoundOnPositionSound played when this part reaches its final position.
private float repairBoxScaleMultiplier on the part's final scale used by RepairBox.
private Transform transformThe transform being animated.

Properties​

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

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