Added basic features
This commit is contained in:
28
Assets/Scripts/Manager/EventManager.cs
Normal file
28
Assets/Scripts/Manager/EventManager.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class EventManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private Player _player;
|
||||
[SerializeField]
|
||||
private Goal _goal;
|
||||
|
||||
[SerializeField]
|
||||
private UIManager _uiManager;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_player.OnPlayerDead += OnPlayerDead;
|
||||
_goal.OnGoalReached += OnGoalReached;
|
||||
}
|
||||
|
||||
private void OnPlayerDead()
|
||||
{
|
||||
_uiManager.ShowGameOverPanel();
|
||||
}
|
||||
|
||||
private void OnGoalReached()
|
||||
{
|
||||
_uiManager.ShowSuccessPanel();
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Manager/EventManager.cs.meta
Normal file
2
Assets/Scripts/Manager/EventManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af923ff614fb8024282a2485ad26f7c1
|
||||
34
Assets/Scripts/Manager/StartMenuManager.cs
Normal file
34
Assets/Scripts/Manager/StartMenuManager.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class StartMenuManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject _menuPanelUI;
|
||||
[SerializeField]
|
||||
private GameObject _settingPanelUI;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_menuPanelUI.SetActive(true);
|
||||
_settingPanelUI.SetActive(false);
|
||||
}
|
||||
|
||||
public void StartGame()
|
||||
{
|
||||
}
|
||||
|
||||
public void SetSettingPanelActive(bool value)
|
||||
{
|
||||
_settingPanelUI.SetActive(value);
|
||||
_menuPanelUI.SetActive(!value);
|
||||
}
|
||||
|
||||
public void Quit()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorApplication.ExitPlaymode();
|
||||
#else
|
||||
Application.Quit();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Manager/StartMenuManager.cs.meta
Normal file
2
Assets/Scripts/Manager/StartMenuManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61048706ae5a77947a3a95bf45709ac1
|
||||
32
Assets/Scripts/Manager/UIManager.cs
Normal file
32
Assets/Scripts/Manager/UIManager.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class UIManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject _menuPanelUI;
|
||||
[SerializeField]
|
||||
private GameObject _successPanel;
|
||||
[SerializeField]
|
||||
private GameObject _gameOverPanel;
|
||||
|
||||
private void InitUI()
|
||||
{
|
||||
_successPanel.SetActive(false);
|
||||
_gameOverPanel.SetActive(false);
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InitUI();
|
||||
}
|
||||
|
||||
public void ShowSuccessPanel()
|
||||
{
|
||||
_successPanel.SetActive(true);
|
||||
}
|
||||
|
||||
public void ShowGameOverPanel()
|
||||
{
|
||||
_gameOverPanel.SetActive(true);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Manager/UIManager.cs.meta
Normal file
2
Assets/Scripts/Manager/UIManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 508242b6a15bf0e4f9fd0c8ff93b7371
|
||||
Reference in New Issue
Block a user