using System; using System.Collections; using System.Collections.Generic; namespace Net.Project.B.Interaction { public enum WorldInteractionProcess { None, Hover, Started, Tap, Hold, Performed, } /// /// 可互动类型 /// public interface IWorldInteractable { public int Id { get; } public IWorldInteractable Root { get; } public IWorldInteractionType InteractionType { get; } public object WorldObject { get; set; } } /// /// 世界互动服务 /// public interface IWorldInteractionService { /// /// 注册可互动对象 /// /// /// public bool Register(IWorldInteractable interactable); /// /// 注销可互动对象 /// /// /// public bool Unregister(IWorldInteractable interactable); /// /// 尝试获取互动 /// /// 通常是Collider InstanceId /// 可互动对象 /// public bool TryGetValue(int id, out IWorldInteractable interactable); /// /// 互动 /// /// 互动者 /// 互动对象 /// 过程,例如开始,完成,结束 /// 是否互动成功 bool Interaction(object sender,IWorldInteractable interactable,WorldInteractionProcess process=WorldInteractionProcess.Performed); /// /// 互动回调 /// public event Action OnInteraction; } }