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.
- Listed in ATT, Features and other game namespaces
- Inherits or implements
NetworkEntityBehaviour,IRespawnShrine - Derived types
GlobalRespawnShrine,PoweredRespawnShrine
Constructors
| Member | What it is |
|---|---|
protected RespawnShrine() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
| Member | What it is |
|---|---|
protected ColorEvent glyphColorChanged | Event that sets the glyph colour. |
protected Interactable handTouchInteractable | The hand-touch interactable players use on the shrine. |
protected static Logger logger | Shared logger. |
protected IRespawnSystem RespawnSystem | The respawn system, injected. |
1 private and internal field
| Member | What it is |
|---|---|
private MethodSync syncPlaySubscribeAudio | Method sync (SyncB) used to play the subscribe sound on clients. |
Properties
| Member | What it is |
|---|---|
protected abstract Guid ShrineId { get; } | Subclass: the shrine's id. |
protected IRespawnSystemSettings SystemSettings { get; } | Global respawn system settings (glyph colours, sounds). |
Methods
| Member | What 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
| Member | What 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. |