init
This commit is contained in:
commit
fca6784fe7
571 changed files with 84105 additions and 0 deletions
34
Assets/Scripts/Hand/Finger.cs
Normal file
34
Assets/Scripts/Hand/Finger.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue