messing with menu
This commit is contained in:
1 parent
94c7671874
commit
f72d365ebc
26 files changed
+17646
-3129
No files matched your search
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Loader : MonoBehaviour {
|
||||
public KeyCode NextButton = KeyCode.Space;
|
||||
public KeyCode PrevButton = KeyCode.Return;
|
||||
|
||||
public GameObject[] vis;
|
||||
|
||||
private int _current = 0;
|
||||
private int _count;
|
||||
|
||||
void Awake() {
|
||||
vis = GameObject.FindGameObjectsWithTag("VFX");
|
||||
|
||||
foreach (GameObject v in vis) {
|
||||
v.SetActive(false);
|
||||
}
|
||||
|
||||
_count = vis.Length;
|
||||
}
|
||||
|
||||
void Start() {
|
||||
foreach (GameObject v in vis) {
|
||||
Debug.Log(v.ToString());
|
||||
}
|
||||
|
||||
Debug.Log($"{_current}, {_count}");
|
||||
vis[_current].SetActive(true);
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (Input.GetKeyDown(NextButton)) {
|
||||
LoadNextVis();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LoadNextVis() {
|
||||
vis[_current].SetActive(false);
|
||||
int next = (_current + 1) % _count;
|
||||
_current = next;
|
||||
vis[next].SetActive(true);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user