VladimirPirozhenko 6999e84b65 Added pause and pause view, added restriction of input while in paused state
Upgraded Input system to fit demands of paused game (no movement inputs allowed!)
2022-08-12 05:38:17 +03:00

28 lines
703 B
C#

using System.Collections;
using UnityEngine;
public class Pause : MonoBehaviour,ICommandTranslator
{
private bool isOpened = false;
private void Start()
{
GameSession.Instance.AddCommandTranslator(this);
}
public void TranslateCommand(ECommand command, PressedState state)
{
if (state.IsPressed == true)
{
switch (command)
{
case ECommand.OPEN_PAUSE_MENU:
isOpened = isOpened ? false : true;
ViewManager.Instance.Show<PausedView>(isOpened);
GameSession.Instance.PauseSession(isOpened);
break;
}
}
}
}