1
This commit is contained in:
14
Src/Interaction/Com.Project.B.Interaction.asmdef
Normal file
14
Src/Interaction/Com.Project.B.Interaction.asmdef
Normal 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
|
||||
}
|
7
Src/Interaction/Com.Project.B.Interaction.asmdef.meta
Normal file
7
Src/Interaction/Com.Project.B.Interaction.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e527b3ce3106f974585be5134b6200e9
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
64
Src/Interaction/IWorldInteractionService.cs
Normal file
64
Src/Interaction/IWorldInteractionService.cs
Normal 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;
|
||||
}
|
||||
}
|
11
Src/Interaction/IWorldInteractionService.cs.meta
Normal file
11
Src/Interaction/IWorldInteractionService.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a77240fca943a0349904c895ba032c26
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
20
Src/Interaction/IWorldInteractions.cs
Normal file
20
Src/Interaction/IWorldInteractions.cs
Normal 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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
Src/Interaction/IWorldInteractions.cs.meta
Normal file
11
Src/Interaction/IWorldInteractions.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c6a00515bdf235468aa2da01fffde5b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user