using System; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Splines; public class SplineTarget : MonoBehaviour { public BezierKnot knot; public event Action onKnotChanged; public event Action onChangeFinished; bool isClick; public int index; public int splineIndex; // Update is called once per frame void Update() { /* if (isClick) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { transform.position = hit.point + new Vector3(0, 2, 0); knot.Position = transform.position - new Vector3(0, 2, 0); onKnotChanged?.Invoke(knot, index, splineIndex); } } */ } public void Init(BezierKnot knot, int index, int splineIndex = 0) { this.knot = knot; this.index = index; this.splineIndex = splineIndex; } /* public void OnPointerDown(PointerEventData eventData) { isClick = true; transform.GetComponent().enabled = false; } public void OnPointerUp(PointerEventData eventData) { isClick = false; transform.GetComponent().enabled = true; onChangeFinished?.Invoke(); } public void OnPointerClick(PointerEventData eventData) { Debug.Log("click"); } */ }