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
-
ObjectComponentBehaviourMonoBehaviourSurvivorsGame
- Implements
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.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.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.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.nameObject.hideFlags
Constructors
SurvivorsGame()
public SurvivorsGame()
Properties
CanRestart
public bool CanRestart { get; }
Property Value
CanSave
Runs can be saved between waves only (level-up, shop, or before a wave starts).
public bool CanSave { get; }
Property Value
Cheats
The playtest "cheats used" state of the current run.
public PlaytestCheatState Cheats { get; }
Property Value
CheatsUsed
True when the run used playtest commands (the panel's record or the run's own flag).
public bool CheatsUsed { get; }
Property Value
ConfiguredSeed
public uint ConfiguredSeed { get; }
Property Value
Content
public ContentAsset Content { get; }
Property Value
Controller
public RunController Controller { get; }
Property Value
DefaultMode
public RunMode DefaultMode { get; }
Property Value
LastResult
public WaveResultDisplay LastResult { get; }
Property Value
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
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
Options
The device options in effect (shared by every session; see GameOptions).
public OptionsState Options { get; }
Property Value
Paused
public bool Paused { get; }
Property Value
Playtest
The run's playtest commands (the run controller implements IPlaytestCommands); null without a run.
public IPlaytestCommands Playtest { get; }
Property Value
Profile
The player's profile: unlocks and records. Never null. The saved run is SavedRun.
public ProfileState Profile { get; }
Property Value
RerollCost
public int RerollCost { get; }
Property Value
Run
public RunState Run { get; }
Property Value
SavedRun
The single saved run slot, or null.
public RunSnapshot SavedRun { get; }
Property Value
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
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
World
The running wave's world, or null between waves.
public SimWorld World { get; }
Property Value
Methods
Act(Func<RunController, RunResult>)
public RunResult Act(Func<RunController, RunResult> action)
Parameters
actionFunc<RunController, RunResult>
Returns
AdvanceFrame(float)
A host can also drive this component. A stalled frame never produces unbounded catch-up.
public void AdvanceFrame(float seconds)
Parameters
secondsfloat
ApplyOptions(OptionsState)
Applies options now (audio, window, shake, flashes, damage numbers, focus pause). Call SaveOptions() to keep them.
public void ApplyOptions(OptionsState options)
Parameters
optionsOptionsState
ApplyUnlocks(RunContent)
Marks unlock targets in definitions available or locked from the profile.
public void ApplyUnlocks(RunContent definitions)
Parameters
definitionsRunContent
Begin()
public RunResult Begin()
Returns
Begin(RunRequest)
Fixed seeds replay; zero seeds are resolved independently on each new attempt.
public RunResult Begin(RunRequest request)
Parameters
requestRunRequest
Returns
BuildRunRequest()
Builds a menu template without consuming a seed or starting gameplay.
public RunRequest BuildRunRequest()
Returns
BuildRunRequest(RunMode)
Builds a menu template for runMode with that mode's settings.
public RunRequest BuildRunRequest(RunMode runMode)
Parameters
runModeRunMode
Returns
BuildStats()
public StatBuild BuildStats()
Returns
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
namestringcommandFunc<IPlaytestCommands, RunResult>
Returns
Configure(RunSystems, IPlayerInput)
Optional dependency injection before Begin (replay input or custom rules).
public void Configure(RunSystems systems, IPlayerInput input)
Parameters
systemsRunSystemsinputIPlayerInput
Continue()
Continues the profile's saved run with the content and the saved mode's settings.
public RunResult Continue()
Returns
Continue(RunRequest)
public RunResult Continue(RunRequest template)
Parameters
templateRunRequest
Returns
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
templateRunRequestrunModeRunMode
Returns
HasModeSettings(RunMode)
True when runMode has a settings asset of its own (not just the content's).
public bool HasModeSettings(RunMode runMode)
Parameters
runModeRunMode
Returns
RecycleRefund(WeaponItemDef)
public int RecycleRefund(WeaponItemDef weapon)
Parameters
weaponWeaponItemDef
Returns
RegisterView(IWaveView)
public void RegisterView(IWaveView view)
Parameters
viewIWaveView
Restart()
public RunResult Restart()
Returns
ReturnToMenu()
public void ReturnToMenu()
SaveAndQuit()
Saves the run into the profile and returns to the menu. Only between waves (CanSave).
public RunResult SaveAndQuit()
Returns
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
valueContentAssetdefaultModeRunModerunSeeduintarenaGameSettingsAssetfieldGameSettingsAsset
SetPaused(bool)
public void SetPaused(bool value)
Parameters
valuebool
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
storeIProfileStore
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
profileIProfileStorerunIRunStoreoptionsIOptionsStore
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
runModeRunMode
Returns
SlotWeaponId(int)
Item id of the weapon in slot at the last tick, or null.
public string SlotWeaponId(int slot)
Parameters
slotint
Returns
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
countint
Returns
UnregisterView(IWaveView)
public void UnregisterView(IWaveView view)
Parameters
viewIWaveView
Events
PauseChanged
public event Action<bool> PauseChanged
Event Type
PhaseChanged
public event Action<RunPhase> PhaseChanged
Event Type
ProfileChanged
Raised after the profile changed (run recorded, run saved, store replaced).
public event Action ProfileChanged
Event Type
StateChanged
public event Action StateChanged
Event Type
WaveFinished
public event Action<WaveResultDisplay> WaveFinished