window mode and botany wip
This commit is contained in:
1 parent
f0aa6495c7
commit
0f9576a67b
68 files changed
+8224
-1311
No files matched your search
@@ -0,0 +1,97 @@
|
||||
using Assets.WasapiAudio.Scripts.Unity;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.VFX;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
public class Loader : MonoBehaviour {
|
||||
public Text currentVis;
|
||||
public Canvas vfxMenu;
|
||||
|
||||
private static bool menuVisible;
|
||||
private Scene scene;
|
||||
private KeyCode NextButton = KeyCode.Space;
|
||||
private KeyCode PrevButton = KeyCode.Backspace;
|
||||
private KeyCode MenuButton = KeyCode.Escape;
|
||||
|
||||
void Awake() {
|
||||
ToggleMenu(menuVisible);
|
||||
}
|
||||
|
||||
void Start() {
|
||||
scene = SceneManager.GetActiveScene();
|
||||
currentVis.text = scene.name;
|
||||
// Debug.Log("Active Scene name is: " + scene.name + "\nActive Scene index: " + scene.buildIndex);
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (Input.GetKeyDown(NextButton)) {
|
||||
NextScene();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(PrevButton)) {
|
||||
PrevScene();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(MenuButton)) {
|
||||
ToggleMenu(!menuVisible);
|
||||
}
|
||||
}
|
||||
|
||||
void VfxMenuVisible(bool v) {
|
||||
if (vfxMenu) vfxMenu.enabled = v;
|
||||
}
|
||||
|
||||
void ToggleMenu(bool visible) {
|
||||
if (visible) {
|
||||
gameObject.GetComponent<Canvas>().enabled = true;
|
||||
VfxMenuVisible(true);
|
||||
} else {
|
||||
gameObject.GetComponent<Canvas>().enabled = false;
|
||||
VfxMenuVisible(false);
|
||||
}
|
||||
|
||||
menuVisible = visible;
|
||||
}
|
||||
|
||||
public void NextScene() {
|
||||
int current = scene.buildIndex;
|
||||
int next = (current + 1) % (SceneManager.sceneCountInBuildSettings);
|
||||
|
||||
// welcome is at 0. skip it
|
||||
if (next == 0) next = 1;
|
||||
if (next != current) LoadScene(next);
|
||||
}
|
||||
|
||||
public void PrevScene() {
|
||||
int current = scene.buildIndex;
|
||||
int prev = (current - 1);
|
||||
// check for welcome
|
||||
if (prev <= 0) prev = SceneManager.sceneCountInBuildSettings - 1;
|
||||
if (prev != current) LoadScene(prev);
|
||||
}
|
||||
|
||||
public void LoadScene(int i) {
|
||||
SceneManager.LoadScene(i);
|
||||
}
|
||||
|
||||
public void Quit() {
|
||||
// if (EditorApplication) EditorApplication.isPlaying = false;
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
// IEnumerator LoadScene(int i) {
|
||||
// AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(i);
|
||||
|
||||
// // Wait until the asynchronous scene fully loads
|
||||
// while (!asyncLoad.isDone)
|
||||
// {
|
||||
// yield return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user