[+] 接入ET8服务端

[+] 接入ET8服务端
This commit is contained in:
ALEXTANG
2023-07-13 12:23:48 +08:00
parent e0be062006
commit 336d4b2eb9
1316 changed files with 130657 additions and 626 deletions

View File

@@ -0,0 +1,62 @@
using System.Diagnostics;
using MongoDB.Bson.Serialization.Attributes;
using Unity.Mathematics;
namespace ET
{
[ChildOf(typeof(UnitComponent))]
[DebuggerDisplay("ViewName,nq")]
public class Unit: Entity, IAwake<int>
{
public int ConfigId { get; set; } //配置表id
[BsonIgnore]
public UnitConfig Config => UnitConfigCategory.Instance.Get(this.ConfigId);
public UnitType Type => (UnitType)UnitConfigCategory.Instance.Get(this.ConfigId).Type;
[BsonElement]
private float3 position; //坐标
[BsonIgnore]
public float3 Position
{
get => this.position;
set
{
float3 oldPos = this.position;
this.position = value;
EventSystem.Instance.Publish(this.Scene(), new EventType.ChangePosition() { Unit = this, OldPos = oldPos });
}
}
[BsonIgnore]
public float3 Forward
{
get => math.mul(this.Rotation, math.forward());
set => this.Rotation = quaternion.LookRotation(value, math.up());
}
[BsonElement]
private quaternion rotation;
[BsonIgnore]
public quaternion Rotation
{
get => this.rotation;
set
{
this.rotation = value;
EventSystem.Instance.Publish(this.Scene(), new EventType.ChangeRotation() { Unit = this });
}
}
protected override string ViewName
{
get
{
return $"{this.GetType().FullName} ({this.Id})";
}
}
}
}

View File

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

View File

@@ -0,0 +1,8 @@
namespace ET
{
[ComponentOf(typeof(Scene))]
public class UnitComponent: Entity, IAwake, IDestroy
{
}
}

View File

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

View File

@@ -0,0 +1,18 @@
using Unity.Mathematics;
namespace ET
{
namespace EventType
{
public struct ChangePosition
{
public Unit Unit;
public float3 OldPos;
}
public struct ChangeRotation
{
public Unit Unit;
}
}
}

View File

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

View File

@@ -0,0 +1,9 @@
namespace ET
{
public enum UnitType: byte
{
Player = 1,
Monster = 2,
NPC = 3,
}
}

View File

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