VladimirPirozhenko 0fb508126d Updated InputTranslator and View manager, it fixed few bugs with allowing controls
InputTranslator now can check whether is translation is restricted, added new method to ViewManager - IsActive - to check if view is active or not
2022-08-13 02:45:01 +03:00

28 lines
739 B
C#

using System.Collections;
using UnityEngine;
public class Pause : MonoBehaviour,ICommandTranslator
{
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:
bool isOpened = ViewManager.Instance.IsActive<PausedView>();
isOpened = !isOpened;
ViewManager.Instance.Show<PausedView>(isOpened);
GameSession.Instance.PauseSession(isOpened);
break;
}
}
}
}