initial commit
This commit is contained in:
15
Assets/Scripts/Project/GameManagerScript.cs
Normal file
15
Assets/Scripts/Project/GameManagerScript.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManagerScript : MonoBehaviour
|
||||
{
|
||||
void Start()
|
||||
{
|
||||
Application.targetFrameRate = 60;
|
||||
QualitySettings.vSyncCount = 0;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Project/GameManagerScript.cs.meta
Normal file
11
Assets/Scripts/Project/GameManagerScript.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef601aec25fc12a43bfbe138d049212a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
Assets/Scripts/Project/MenuController.cs
Normal file
63
Assets/Scripts/Project/MenuController.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MenuController : MonoBehaviour
|
||||
{
|
||||
public static MenuController Instance { get; private set; }
|
||||
|
||||
public GameObject pauseMenuPanel;
|
||||
public Button resumeButton;
|
||||
public Button quitButton;
|
||||
|
||||
public bool isPaused = false;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
else if (Instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
resumeButton.onClick.AddListener(TogglePause);
|
||||
quitButton.onClick.AddListener(CloseGame);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
TogglePause();
|
||||
}
|
||||
}
|
||||
void TogglePause()
|
||||
{
|
||||
isPaused = !isPaused;
|
||||
pauseMenuPanel.SetActive(isPaused);
|
||||
|
||||
if (isPaused)
|
||||
{
|
||||
Time.timeScale = 0f;
|
||||
Cursor.lockState = CursorLockMode.None;
|
||||
Cursor.visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Time.timeScale = 1f;
|
||||
Cursor.lockState = CursorLockMode.Locked;
|
||||
Cursor.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void CloseGame()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Project/MenuController.cs.meta
Normal file
11
Assets/Scripts/Project/MenuController.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e09424ee66487a4c829b89df5fc3887
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/Scripts/Project/Screenshooter.cs
Normal file
32
Assets/Scripts/Project/Screenshooter.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Screenshooter : MonoBehaviour
|
||||
{
|
||||
public Camera cam;
|
||||
public int width = 3840;
|
||||
public int height = 2160;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.F12))
|
||||
{
|
||||
RenderTexture rt = new RenderTexture(width, height, 24);
|
||||
cam.targetTexture = rt;
|
||||
|
||||
Texture2D image = new Texture2D(width, height, TextureFormat.RGB24, false);
|
||||
cam.Render();
|
||||
RenderTexture.active = rt;
|
||||
image.ReadPixels(new Rect(0, 0, width, height), 0, 0);
|
||||
image.Apply();
|
||||
|
||||
cam.targetTexture = null;
|
||||
RenderTexture.active = null;
|
||||
Destroy(rt);
|
||||
|
||||
System.IO.File.WriteAllBytes(
|
||||
"screenshot_4k.png",
|
||||
image.EncodeToPNG()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Project/Screenshooter.cs.meta
Normal file
11
Assets/Scripts/Project/Screenshooter.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c666a8f574985443b3c7630ec3de08c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user