messing with menu

This commit is contained in:
unknown committed 2022-02-03 12:22:25 +11:00
1 parent fc47b58209
commit d584f45dd3
26 files changed
+17646 -3129

No files matched your search

+46
View File
@@ -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);
}
}