using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; public class MouseFollow : MonoBehaviour { // Start is called before the first frame update public Image image; public int 正确ID; public Button 正确button, 错误button; void Start() { } // Update is called once per frame void Update() { image.transform.position = Input.mousePosition; } public void ChangeMouse(int id) { if (id == 正确ID) { 正确button.gameObject.SetActive(true); 错误button.gameObject.SetActive(false); } else { 正确button.gameObject.SetActive(false); 错误button.gameObject.SetActive(true); } image.gameObject.SetActive(true); image.sprite = EventSystem.current.currentSelectedGameObject.GetComponent().sprite; } public void ChangID(int id) { 正确ID = id; } public void Change正确button(Button obj) { 正确button = obj; } }