mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
[+] 接入ET8服务端
[+] 接入ET8服务端
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using System.Collections.Generic;
|
||||
using Unity.Mathematics;
|
||||
|
||||
namespace ET.Server
|
||||
{
|
||||
[ComponentOf(typeof(Unit))]
|
||||
public class AOIEntity: Entity, IAwake<int, float3>, IDestroy
|
||||
{
|
||||
public Unit Unit => this.GetParent<Unit>();
|
||||
|
||||
public int ViewDistance;
|
||||
|
||||
private EntityRef<Cell> cell;
|
||||
|
||||
public Cell Cell
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.cell;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.cell = value;
|
||||
}
|
||||
}
|
||||
|
||||
// 观察进入视野的Cell
|
||||
public HashSet<long> SubEnterCells = new HashSet<long>();
|
||||
|
||||
// 观察离开视野的Cell
|
||||
public HashSet<long> SubLeaveCells = new HashSet<long>();
|
||||
|
||||
// 观察进入视野的Cell
|
||||
public HashSet<long> enterHashSet = new HashSet<long>();
|
||||
|
||||
// 观察离开视野的Cell
|
||||
public HashSet<long> leaveHashSet = new HashSet<long>();
|
||||
|
||||
// 我看的见的Unit
|
||||
public Dictionary<long, AOIEntity> SeeUnits = new Dictionary<long, AOIEntity>();
|
||||
|
||||
// 看见我的Unit
|
||||
public Dictionary<long, AOIEntity> BeSeeUnits = new Dictionary<long, AOIEntity>();
|
||||
|
||||
// 我看的见的Player
|
||||
public Dictionary<long, AOIEntity> SeePlayers = new Dictionary<long, AOIEntity>();
|
||||
|
||||
// 看见我的Player单独放一个Dict,用于广播
|
||||
public Dictionary<long, AOIEntity> BeSeePlayers = new Dictionary<long, AOIEntity>();
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82e4e3a5d5dabb049bf406df3ec3dbd3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,17 @@
|
||||
namespace ET.Server
|
||||
{
|
||||
namespace EventType
|
||||
{
|
||||
public struct UnitEnterSightRange
|
||||
{
|
||||
public AOIEntity A;
|
||||
public AOIEntity B;
|
||||
}
|
||||
|
||||
public struct UnitLeaveSightRange
|
||||
{
|
||||
public AOIEntity A;
|
||||
public AOIEntity B;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2fb3b7c085835bc45b9bf319fb179f8b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
namespace ET.Server
|
||||
{
|
||||
[ComponentOf(typeof(Scene))]
|
||||
public class AOIManagerComponent: Entity, IAwake
|
||||
{
|
||||
public const int CellSize = 10 * 1000;
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ac4abb8f844e8543b742c9eb837c9e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
17
Assets/GameScripts/DotNet/Model/Server/Module/AOI/Cell.cs
Normal file
17
Assets/GameScripts/DotNet/Model/Server/Module/AOI/Cell.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ET.Server
|
||||
{
|
||||
[ChildOf(typeof(AOIManagerComponent))]
|
||||
public class Cell: Entity, IAwake, IDestroy
|
||||
{
|
||||
// 处在这个cell的单位
|
||||
public Dictionary<long, AOIEntity> AOIUnits = new Dictionary<long, AOIEntity>();
|
||||
|
||||
// 订阅了这个Cell的进入事件
|
||||
public Dictionary<long, AOIEntity> SubsEnterEntities = new Dictionary<long, AOIEntity>();
|
||||
|
||||
// 订阅了这个Cell的退出事件
|
||||
public Dictionary<long, AOIEntity> SubsLeaveEntities = new Dictionary<long, AOIEntity>();
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a75cc6d8fbc87d4386d2159f6ac48f2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user