using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; public class Finger : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler{ [SerializeField, Range(1, 5)] int fingerIndex = 1; bool selected; HandManager hand; void Awake(){ hand = GetComponentInParent(); } public void OnPointerEnter(PointerEventData eventData){ selected = true; } public void OnPointerExit(PointerEventData eventData){ selected = false; } // Update is called once per frame void Update(){ if (selected){ if (Input.GetMouseButtonDown(0)){ hand.Cut(fingerIndex); //gameObject.SetActive(false); } } } }