HartoukChartEditor/Assets/Script/PlayObject/Slider/DataFlowUnitAnchorControlle...

30 lines
844 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
/// <summary>
/// 仅仅是给射线一个开盒蛇引用的机会,将会直接持有父类的数据,击中任意锚点都会获取到父类的数据
/// </summary>
public class DataFlowUnitAnchorController :MonoBehaviour, IRaycastHittable
{
RuntimeBaseNoteData SelfRef=null;
/// <summary>
/// 重写射线命中方法,确保能正确返回引用
/// </summary>
public RuntimeBaseNoteData OnHitByRay(RaycastHit hit)
{
// 如果自身没有 SelfRef尝试从父对象获取
if (SelfRef == null)
{
Debug.LogError($"当前对象没有数据");
}
Debug.Log($"DataFlow锚点被击中了\n自身引用为{SelfRef}\n碰撞点: {hit.point}, 法线: {hit.normal}\n");
return SelfRef;
}
/// <summary>
/// 用于设置数据项目
/// </summary>
public void SetSelfRef(RuntimeBaseNoteData data)
{
SelfRef = data;
}
}