Ropasci-Forest/Assets/Scripts/Hand/Finger.cs
Gerard Gascón fca6784fe7 init
2025-04-24 17:02:43 +02:00

34 lines
800 B
C#

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<HandManager>();
}
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);
}
}
}
}