47 lines
977 B
C#
47 lines
977 B
C#
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);
|
|
}
|
|
}
|