This commit is contained in:
CortexCore
2024-11-23 17:20:13 +08:00
commit bb257507bc
133 changed files with 2574 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
{
"name": "Com.Project.B.Interaction",
"rootNamespace": "",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": true
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e527b3ce3106f974585be5134b6200e9
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,64 @@
using System;
using System.Collections;
using System.Collections.Generic;
namespace Net.Project.B.Interaction
{
public enum WorldInteractionProcess
{
None,
Hover,
Started,
Tap,
Hold,
Performed,
}
/// <summary>
/// 可互动类型
/// </summary>
public interface IWorldInteractable
{
public int Id { get; }
public IWorldInteractable Root { get; }
public IWorldInteractionType InteractionType { get; }
public object WorldObject { get; set; }
}
/// <summary>
/// 世界互动服务
/// </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>
/// <param name="id">通常是Collider InstanceId</param>
/// <param name="interactable">可互动对象</param>
/// <returns></returns>
public bool TryGetValue(int id, out IWorldInteractable interactable);
/// <summary>
/// 互动
/// </summary>
/// <param name="sender">互动者</param>
/// <param name="interactable">互动对象</param>
/// <param name="process">过程,例如开始,完成,结束</param>
/// <returns>是否互动成功</returns>
bool Interaction(object sender,IWorldInteractable interactable,WorldInteractionProcess process=WorldInteractionProcess.Performed);
/// <summary>
/// 互动回调
/// </summary>
public event Action<object,IWorldInteractable,WorldInteractionProcess,object> OnInteraction;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a77240fca943a0349904c895ba032c26
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
namespace Net.Project.B.Interaction
{
/// <summary>
/// 互动类型
/// </summary>
public interface IWorldInteractionType
{
}
/// <summary>
/// 长按互动
/// </summary>
public interface IWorldHoldingInteraction
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4c6a00515bdf235468aa2da01fffde5b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: