forked from Shardstone/trail-into-darkness
First commit on my server, yey!
This commit is contained in:
47
Assets/Code/GameState/PlayModes/PauseMenuPlayMode.cs
Normal file
47
Assets/Code/GameState/PlayModes/PauseMenuPlayMode.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
#nullable enable
|
||||
using Nox.Core;
|
||||
using Nox.Platform;
|
||||
using Nox.Game.UI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Nox.Game {
|
||||
public class PauseMenuPlayMode : IPlayMode {
|
||||
private readonly PlatformSettings platformSettings;
|
||||
private readonly GameDataState gameDataState;
|
||||
private PauseMenuReferences? pauseMenuReference;
|
||||
private readonly IMenuView? pauseMenuView;
|
||||
private readonly InputSystem_Actions inputActions;
|
||||
|
||||
public PauseMenuPlayMode(PlatformSettings platformSettings, GameDataState gameDataState, IMenuView pauseMenuView) {
|
||||
this.platformSettings = platformSettings;
|
||||
this.gameDataState = gameDataState;
|
||||
this.pauseMenuView = pauseMenuView;
|
||||
inputActions = platformSettings.inputSettings.inputActions;
|
||||
inputActions.UI.Enable();
|
||||
}
|
||||
|
||||
public bool IsGameModeInitialized { get; private set; }
|
||||
|
||||
public void EnterPlayMode() {
|
||||
Debug.Log("Entering PauseMenu Play Mode");
|
||||
pauseMenuView?.Initialize();
|
||||
IsGameModeInitialized = true;
|
||||
}
|
||||
|
||||
public void Tick() {
|
||||
if(inputActions.UI.PauseMenu.WasPerformedThisFrame()) {
|
||||
pauseMenuView?.Hide();
|
||||
gameDataState.ChangePlayMode(gameDataState.PreviousPlayMode);
|
||||
}
|
||||
pauseMenuView?.Tick();
|
||||
}
|
||||
public void LateTick() { }
|
||||
public void ExitGameMode() {
|
||||
pauseMenuView?.Hide();
|
||||
}
|
||||
public void Dispose() {
|
||||
inputActions.UI.Disable();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user