literally half of the game
This commit is contained in:
parent
1590b5faa6
commit
b842289076
77 changed files with 11904 additions and 72 deletions
63
Assets/Scripts/GameManager.cs
Normal file
63
Assets/Scripts/GameManager.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
#region Statication
|
||||
|
||||
public static GameManager instance;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (instance != null && instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
DontDestroyOnLoad(this);
|
||||
instance = this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
//this is just for general functions and variables that will be reused
|
||||
public Camera camera;
|
||||
public GameObject pauseMenu;
|
||||
public Vector3 GetMouseWorldPos()
|
||||
{
|
||||
return camera.ScreenToWorldPoint(Input.mousePosition);
|
||||
}
|
||||
|
||||
public void SetPause(bool state)
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
Time.timeScale = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPauseMenu()
|
||||
{
|
||||
if (!pauseMenu.activeSelf)
|
||||
{
|
||||
SetPause(true);
|
||||
pauseMenu.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
pauseMenu.SetActive(false);
|
||||
SetPause(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
SetPauseMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue