Skip to main content

RespawnShrine

An abstract class in Root.Township, ATT.Respawn.

Base for a respawn shrine in the world that players touch to set as their spawn point. Listens to the respawn system model and shows a glyph colour for whether the local player is linked.

Constructors​

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

Fields​

MemberWhat it is
protected ColorEvent glyphColorChangedEvent that sets the glyph colour.
protected Interactable handTouchInteractableThe hand-touch interactable players use on the shrine.
protected static Logger loggerShared logger.
protected IRespawnSystem RespawnSystemThe respawn system, injected.
1 private and internal field
MemberWhat it is
private MethodSync syncPlaySubscribeAudioMethod sync (SyncB) used to play the subscribe sound on clients.

Properties​

MemberWhat it is
protected abstract Guid ShrineId { get; }Subclass: the shrine's id.
protected IRespawnSystemSettings SystemSettings { get; }Global respawn system settings (glyph colours, sounds).

Methods​

MemberWhat it is
virtual void OnSetSpawnPointToggle(IPlayer player)Tells clients nearby to play the subscribe sound when a player toggles this shrine as their spawn.
protected virtual void Awake()Hooks the interaction filter and creates the audio sync.
protected void Inject(IRespawnSystem respawnSystem)VContainer injection of the respawn system.
protected virtual void OnDestroy()Stops listening to the model and unhooks the filter.
protected abstract void OnInteractionFilter(Interactor interactor, Interactable interactable, ref bool result)Subclass: decides whether a touch is allowed.
protected abstract void OnModelChanged(IRespawnSystemModel model)Subclass: reacts to a change in the respawn system model.
protected void PlaySoundEffectForPlayer(SoundEffectSet shrineSfx)Client: plays a sound on the local player's head.
protected virtual void Start()Starts listening to respawn model changes and applies the current model.
protected void UpdateShrineGlyphColor(bool isSubscribedToShrine)Sets the glyph to the active or inactive colour. Skipped on a remote server.
2 private and internal methods
MemberWhat it is
private bool CanPlaySfx(SoundEffectSet shrineSfx)True on clients when the sound is set and the local player has a controller.
private void SyncPlaySubscribeAudio(IPlayer player, Stream stream)Method sync body; clients play the shrine subscribe sound when they read it.