using System.Collections; using System.Collections.Generic; using UnityEngine; public class NewBehaviourScript : MonoBehaviour { // Start is called before the first frame update public GameObject[] games; public GameObject xuanxiang2, xuanxiang2anniu; public int id, querenID; public GameObject xuanxiang3, xuanxiang3anniu; void Start() { } // Update is called once per frame void Update() { } public void Set(int offect) { id += offect; if(id> games.Length-1) { id = 0; } if(id<0) { id = games.Length - 1; } for (int i = 0; i < games.Length; i++) { games[i].SetActive(false); } games[id].SetActive(true); } public void queren() {if (id == querenID) { xuanxiang2anniu.SetActive(false); xuanxiang2.SetActive(false); xuanxiang3.SetActive(true); if (xuanxiang3anniu != null) { xuanxiang3anniu.SetActive(true); } } } }