Class SurvivorsGame

Namespace
SurvivorsMaker.Presentation
Assembly
SurvivorsMaker.Presentation.dll

Owns presentation time. All gameplay changes go through the run controller.

public sealed class SurvivorsGame : MonoBehaviour, IGameSession
Inheritance
Object
Component
Behaviour
MonoBehaviour
SurvivorsGame
Implements
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

SurvivorsGame()

public SurvivorsGame()

Properties

CanRestart

public bool CanRestart { get; }

Property Value

bool

CanSave

Runs can be saved between waves only (level-up, shop, or before a wave starts).

public bool CanSave { get; }

Property Value

bool

Cheats

The playtest "cheats used" state of the current run.

public PlaytestCheatState Cheats { get; }

Property Value

PlaytestCheatState

CheatsUsed

True when the run used playtest commands (the panel's record or the run's own flag).

public bool CheatsUsed { get; }

Property Value

bool

ConfiguredSeed

public uint ConfiguredSeed { get; }

Property Value

uint

Content

public ContentAsset Content { get; }

Property Value

ContentAsset

Controller

public RunController Controller { get; }

Property Value

RunController

DefaultMode

public RunMode DefaultMode { get; }

Property Value

RunMode

LastResult

public WaveResultDisplay LastResult { get; }

Property Value

WaveResultDisplay

LastUnlocks

Unlocks earned by the run that just ended; cleared when the next run starts or on return to the menu.

public IReadOnlyList<UnlockDef> LastUnlocks { get; }

Property Value

IReadOnlyList<UnlockDef>

Ledger

Damage dealt and taken, level-ups and gains of the current (or last) run, for the DPS meter and the run summary.

public CombatLedger Ledger { get; }

Property Value

CombatLedger

Options

The device options in effect (shared by every session; see GameOptions).

public OptionsState Options { get; }

Property Value

OptionsState

Paused

public bool Paused { get; }

Property Value

bool

Playtest

The run's playtest commands (the run controller implements IPlaytestCommands); null without a run.

public IPlaytestCommands Playtest { get; }

Property Value

IPlaytestCommands

Profile

The player's profile: unlocks and records. Never null. The saved run is SavedRun.

public ProfileState Profile { get; }

Property Value

ProfileState

RerollCost

public int RerollCost { get; }

Property Value

int

Run

public RunState Run { get; }

Property Value

RunState

SavedRun

The single saved run slot, or null.

public RunSnapshot SavedRun { get; }

Property Value

RunSnapshot

Speed

Game speed (1 = normal), clamped to MinSpeed–MaxSpeed. It scales the fixed-tick accumulator, so the simulation stays deterministic: only more or fewer ticks run per frame.

public float Speed { get; set; }

Property Value

float

StepHold

Holds the simulation without the pause screen: no ticks run until StepTicks(int). For the playtest panel's single-step mode.

public bool StepHold { get; set; }

Property Value

bool

World

The running wave's world, or null between waves.

public SimWorld World { get; }

Property Value

SimWorld

Methods

Act(Func<RunController, RunResult>)

public RunResult Act(Func<RunController, RunResult> action)

Parameters

action Func<RunController, RunResult>

Returns

RunResult

AdvanceFrame(float)

A host can also drive this component. A stalled frame never produces unbounded catch-up.

public void AdvanceFrame(float seconds)

Parameters

seconds float

ApplyOptions(OptionsState)

Applies options now (audio, window, shake, flashes, damage numbers, focus pause). Call SaveOptions() to keep them.

public void ApplyOptions(OptionsState options)

Parameters

options OptionsState

ApplyUnlocks(RunContent)

Marks unlock targets in definitions available or locked from the profile.

public void ApplyUnlocks(RunContent definitions)

Parameters

definitions RunContent

Begin()

public RunResult Begin()

Returns

RunResult

Begin(RunRequest)

Fixed seeds replay; zero seeds are resolved independently on each new attempt.

public RunResult Begin(RunRequest request)

Parameters

request RunRequest

Returns

RunResult

BuildRunRequest()

Builds a menu template without consuming a seed or starting gameplay.

public RunRequest BuildRunRequest()

Returns

RunRequest

BuildRunRequest(RunMode)

Builds a menu template for runMode with that mode's settings.

public RunRequest BuildRunRequest(RunMode runMode)

Parameters

runMode RunMode

Returns

RunRequest

BuildStats()

public StatBuild BuildStats()

Returns

StatBuild

Cheat(string, Func<IPlaytestCommands, RunResult>)

Runs one playtest command (see Playtest) and refreshes the views. A wave the command ended is completed; items and weapons it added are recorded as cheat gains. name is kept for the panel's log.

public RunResult Cheat(string name, Func<IPlaytestCommands, RunResult> command)

Parameters

name string
command Func<IPlaytestCommands, RunResult>

Returns

RunResult

Configure(RunSystems, IPlayerInput)

Optional dependency injection before Begin (replay input or custom rules).

public void Configure(RunSystems systems, IPlayerInput input)

Parameters

systems RunSystems
input IPlayerInput

Continue()

Continues the profile's saved run with the content and the saved mode's settings.

public RunResult Continue()

Returns

RunResult

Continue(RunRequest)

public RunResult Continue(RunRequest template)

Parameters

template RunRequest

Returns

RunResult

DiscardSavedRun()

Empties the saved run slot (e.g. "start a new run instead").

public void DiscardSavedRun()

ForMode(RunRequest, RunMode)

A copy of template for runMode: the mode changes and, when that mode has a settings asset of its own, its rules replace the template's. One scene can offer both modes this way.

public RunRequest ForMode(RunRequest template, RunMode runMode)

Parameters

template RunRequest
runMode RunMode

Returns

RunRequest

HasModeSettings(RunMode)

True when runMode has a settings asset of its own (not just the content's).

public bool HasModeSettings(RunMode runMode)

Parameters

runMode RunMode

Returns

bool

RecycleRefund(WeaponItemDef)

public int RecycleRefund(WeaponItemDef weapon)

Parameters

weapon WeaponItemDef

Returns

int

RegisterView(IWaveView)

public void RegisterView(IWaveView view)

Parameters

view IWaveView

Restart()

public RunResult Restart()

Returns

RunResult

ReturnToMenu()

public void ReturnToMenu()

SaveAndQuit()

Saves the run into the profile and returns to the menu. Only between waves (CanSave).

public RunResult SaveAndQuit()

Returns

RunResult

SaveOptions()

Writes the options in effect to the options store.

public void SaveOptions()

SetContent(ContentAsset, RunMode, uint, GameSettingsAsset, GameSettingsAsset)

Sets the content, default mode, seed and optional per-mode settings (null = the content's settings) from code, e.g. from SurvivorsSceneBootstrap. Call before a run begins.

public void SetContent(ContentAsset value, RunMode defaultMode, uint runSeed, GameSettingsAsset arena = null, GameSettingsAsset field = null)

Parameters

value ContentAsset
defaultMode RunMode
runSeed uint
arena GameSettingsAsset
field GameSettingsAsset

SetPaused(bool)

public void SetPaused(bool value)

Parameters

value bool

SetProfileStore(IProfileStore)

Replaces where the profile is kept with a store that also holds the saved run in SavedRun (the earlier single-store layout). Call before a run begins. Prefer SetSaveStores(IProfileStore, IRunStore, IOptionsStore).

public void SetProfileStore(IProfileStore store)

Parameters

store IProfileStore

SetSaveStores(IProfileStore, IRunStore, IOptionsStore)

Replaces where progress, the saved run and (optionally) options are kept. Call before a run begins.

public void SetSaveStores(IProfileStore profile, IRunStore run, IOptionsStore options = null)

Parameters

profile IProfileStore
run IRunStore
options IOptionsStore

SettingsFor(RunMode)

The settings asset a run in runMode uses: the mode's own asset, else the content's.

public GameSettingsAsset SettingsFor(RunMode runMode)

Parameters

runMode RunMode

Returns

GameSettingsAsset

SlotWeaponId(int)

Item id of the weapon in slot at the last tick, or null.

public string SlotWeaponId(int slot)

Parameters

slot int

Returns

string

StepTicks(int)

Runs up to count ticks now, ignoring frame time, Speed and StepHold (single-step mode). Stops early when the wave ends or a choice opens. Returns the ticks run.

public int StepTicks(int count = 1)

Parameters

count int

Returns

int

UnregisterView(IWaveView)

public void UnregisterView(IWaveView view)

Parameters

view IWaveView

Events

PauseChanged

public event Action<bool> PauseChanged

Event Type

Action<bool>

PhaseChanged

public event Action<RunPhase> PhaseChanged

Event Type

Action<RunPhase>

ProfileChanged

Raised after the profile changed (run recorded, run saved, store replaced).

public event Action ProfileChanged

Event Type

Action

StateChanged

public event Action StateChanged

Event Type

Action

WaveFinished

public event Action<WaveResultDisplay> WaveFinished

Event Type

Action<WaveResultDisplay>