Skip to main content

CaveTeleporterReplacer

A class in Root.Township, the global namespace.

A GenericReplacer for cave teleporters that plays a dissolve animation from the old object to the new one before finishing the swap. The server sends the effect to clients in the chunk.

Constructors​

MemberWhat it is
CaveTeleporterReplacer()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

8 private and internal fields
MemberWhat it is
private float animationDurationSerialized but not used; the animation reads its timing from CaveTeleportSettings.
private Material baseMaterialSerialized but not used; the animation material comes from CaveTeleportSettings.
private AnimationCurve fadeInCurveSerialized but not used; the fade-in curve comes from CaveTeleportSettings.
private AnimationCurve fadeOutCurveSerialized but not used; the fade-out curve comes from CaveTeleportSettings.
private bool isImmediateTrue only during ReplaceImmediate, so OnReplace skips the animation.
private TransformEvent OnAnimationStartEvent fired on clients (not headless) when the replace animation begins, with this transform.
private RendererGroup renderersRenderers of the old object that fade out.
private MethodSyncStruct<uint> syncEffectSync message carrying the replacing entity's id.

Methods​

MemberWhat it is
override void Initialize()Sets up the sync message used to send the replace effect.
void ReplaceImmediate()Replaces straight away with no animation or sync.
protected override void OnReplace(NetworkEntity replacing)Unless immediate, the server tells clients which entity replaces this one, then the swap finishes after the animation.
1 private and internal method
MemberWhat it is
private void SyncEffect(IPlayer player, Stream stream, uint targetEntity)Sync handler: clients wait for the replacing entity to spawn and then run OnReplace to animate.