This commit is contained in:
CortexCore
2025-03-09 13:38:32 +08:00
parent 787ae12bf8
commit 88f1ff1b04
14 changed files with 181 additions and 35 deletions

View File

@@ -20,8 +20,6 @@ namespace Net.Project.B.Interaction
/// </summary>
public interface IWorldInteractable
{
public int Id { get; }
public IWorldInteractable Root { get; }
public IWorldInteractionType InteractionType { get; }
public object WorldObject { get; set; }
}
@@ -30,18 +28,6 @@ namespace Net.Project.B.Interaction
/// </summary>
public interface IWorldInteractionService
{
/// <summary>
/// 注册可互动对象
/// </summary>
/// <param name="interactable"></param>
/// <returns></returns>
public bool Register(IWorldInteractable interactable);
/// <summary>
/// 注销可互动对象
/// </summary>
/// <param name="interactable"></param>
/// <returns></returns>
public bool Unregister(IWorldInteractable interactable);
/// <summary>
/// 尝试获取互动
/// </summary>

View File

@@ -11,14 +11,16 @@ namespace Net.Project.B.Interaction
public class WorldInteractable : IWorldInteractable,IWorldNode
{
public GameObject gameObject;
public int Id => gameObject.GetInstanceID();
public IWorldInteractable Root => this;
public IWorldInteractionType InteractionType => null;
public object WorldObject
{
get => gameObject;
set => throw new NotImplementedException("Can do that");
set
{
if (value is GameObject go) gameObject = go;
}
}
}
}