Class SurvivorsSceneBootstrap

Namespace
SurvivorsMaker.Presentation
Assembly
SurvivorsMaker.Presentation.dll

One component that turns a scene into a playable game: it connects the session (SurvivorsGame), input, the world view, the UI, music and interface sounds to your content and catalogs. Empty scene references are found in the scene or created. Both run modes work in one scene: the menu's mode toggle switches between ArenaSettings and FieldSettings. Customise from code with an ISceneBootstrapExtension component on the same GameObject.

[DefaultExecutionOrder(-50)]
[AddComponentMenu("Survivor Roguelite Maker/Survivors Scene Bootstrap")]
public sealed class SurvivorsSceneBootstrap : MonoBehaviour
Inheritance
Object
Component
Behaviour
MonoBehaviour
SurvivorsSceneBootstrap
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.didStart
MonoBehaviour.didAwake
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.GetComponentIndex()
Component.CompareTag(TagHandle)
Component.transform
Component.transformHandle
Component.gameObject
Component.tag
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags

Constructors

SurvivorsSceneBootstrap()

public SurvivorsSceneBootstrap()

Fields

AllowModeSwitch

[Tooltip("Show the menu's arena/field toggle.")]
public bool AllowModeSwitch

Field Value

bool

ArenaSettings

[Tooltip("Rules for arena-mode runs (shop between waves). Empty = the content's settings.")]
public GameSettingsAsset ArenaSettings

Field Value

GameSettingsAsset

Camera

Scene camera; unassigned finds one or creates an orthographic camera.

[Tooltip("Scene camera; unassigned finds one or creates an orthographic camera.")]
public Camera Camera

Field Value

Camera

CameraFollowsPlayer

[Tooltip("Add CameraFollow to the camera so it tracks the player inside the arena.")]
public bool CameraFollowsPlayer

Field Value

bool

Content

Required content catalog used by the configured scene.

[Tooltip("Required content catalog used by the configured scene.")]
[Header("Content")]
public ContentAsset Content

Field Value

ContentAsset

CreateMissingUi

[Tooltip("Build the default UI from code when the scene has no GameUiRoot.")]
public bool CreateMissingUi

Field Value

bool

CreatedCameraSize

[Tooltip("Orthographic size of a camera created by the bootstrap.")]
[Min(0.01)]
public float CreatedCameraSize

Field Value

float

DefaultPlayerView

[Tooltip("View catalog id of the player when a character has no entry of its own. Empty = the first character's id.")]
public string DefaultPlayerView

Field Value

string

FieldSettings

[Tooltip("Rules for field-mode runs (level-ups during waves). Empty = the content's settings.")]
public GameSettingsAsset FieldSettings

Field Value

GameSettingsAsset

Game

Session component; unassigned finds one in the scene or creates it.

[Tooltip("Session component; unassigned finds one in the scene or creates it.")]
[Header("Scene (empty = found in the scene or created)")]
public SurvivorsGame Game

Field Value

SurvivorsGame

Input

[Tooltip("Any component implementing IPlayerInput. Empty = InputSystemPlayerInput.")]
public MonoBehaviour Input

Field Value

MonoBehaviour

Mode

[Tooltip("The mode the menu starts on.")]
public RunMode Mode

Field Value

RunMode

Seed

[Tooltip("Fixed run seed. Zero chooses a time-based seed for each run.")]
public uint Seed

Field Value

uint

Sounds

Sound and music catalog; unassigned leaves the scene silent.

[Tooltip("Sound and music catalog; unassigned leaves the scene silent.")]
public SoundCatalogAsset Sounds

Field Value

SoundCatalogAsset

Text

[Tooltip("Optional translations for UI text and content names.")]
public LocalizedTextAsset Text

Field Value

LocalizedTextAsset

Ui

Game UI root; unassigned finds one or creates it when Create Missing UI is on.

[Tooltip("Game UI root; unassigned finds one or creates it when Create Missing UI is on.")]
public GameUiRoot Ui

Field Value

GameUiRoot

View

World renderer; unassigned finds one in the scene or creates it.

[Tooltip("World renderer; unassigned finds one in the scene or creates it.")]
public WorldView View

Field Value

WorldView

Views

Definition-to-view catalog; unassigned uses procedural fallback visuals.

[Tooltip("Definition-to-view catalog; unassigned uses procedural fallback visuals.")]
[Header("Look and sound")]
public ViewCatalogAsset Views

Field Value

ViewCatalogAsset

Properties

Configured

True after ConfigureScene() ran.

public bool Configured { get; }

Property Value

bool

Music

public MusicPlayer Music { get; }

Property Value

MusicPlayer

PlayerInput

The input source given to the session.

public IPlayerInput PlayerInput { get; }

Property Value

IPlayerInput

SoundPlayer

public SoundPlayer SoundPlayer { get; }

Property Value

SoundPlayer

Systems

The run systems the session uses (after ConfigureSystems(RunSystems)).

public RunSystems Systems { get; }

Property Value

RunSystems

UiSounds

public UiSoundBinder UiSounds { get; }

Property Value

UiSoundBinder

Methods

ApplyContent()

Sends Content, Mode, Seed and the mode settings to the session.

public void ApplyContent()

ConfigureScene()

Finds or creates every scene part and wires it. Start calls it once; call it yourself after changing references from code (before a run begins). Throws when Content is missing.

public void ConfigureScene()

Validate()

Problems that stop the scene from working (missing content, characters, arenas or catalogs). Empty = ready. Content validation itself is Validate().

public List<string> Validate()

Returns

List<string>

Events

SceneConfigured

Raised at the end of ConfigureScene().

public event Action<SurvivorsSceneBootstrap> SceneConfigured

Event Type

Action<SurvivorsSceneBootstrap>