added sound script and menu
This commit is contained in:
38
Assets/Scripts/UI/PauseScreenController.cs
Normal file
38
Assets/Scripts/UI/PauseScreenController.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.SceneManagement;
|
||||
using VContainer;
|
||||
|
||||
public class PauseScreenController
|
||||
{
|
||||
private PauseScreenView _pauseScreenView;
|
||||
[Inject]private InputReader _inputReader;
|
||||
public PauseScreenController(PauseScreenView pauseScreenView)
|
||||
{
|
||||
this._pauseScreenView = pauseScreenView;
|
||||
_pauseScreenView.resumeBtn.onClick.AddListener( ResumeBtnClicked);
|
||||
_pauseScreenView.BackBtn.onClick.AddListener(BackBtnClicked);
|
||||
}
|
||||
|
||||
public void ShowPauseScreen()
|
||||
{
|
||||
_inputReader.isBlocked = true;
|
||||
_pauseScreenView.Show();
|
||||
}
|
||||
|
||||
private void ResumeBtnClicked()
|
||||
{
|
||||
_inputReader.isBlocked = false;
|
||||
|
||||
Time.timeScale = 1.0f;
|
||||
_pauseScreenView.Hide();
|
||||
}
|
||||
public void BackBtnClicked()
|
||||
{
|
||||
_inputReader.isBlocked = false;
|
||||
_pauseScreenView.Hide();
|
||||
Time.timeScale = 1.0f;
|
||||
SceneManager.LoadScene(0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user