42 lines
1.2 KiB
C#
Raw Normal View History

2024-08-31 21:05:29 +08:00
using JNGame.Math;
using JNGame.Sync.Frame.Service;
using JNGame.Sync.State.Tile;
using JNGame.Sync.State.Tile.Entity;
2024-09-23 03:50:27 +08:00
using JNGame.Sync.System.Data;
using NotImplementedException = System.NotImplementedException;
2024-08-31 21:05:29 +08:00
namespace Game.Logic.Entity
{
public abstract class EDEntityBasis : JNTileEntity
{
public JNRandomSystem Random => Context.GetSync().GetSystem<JNRandomSystem>();
//获取当前权限瓦块随机点
public LVector3 GetTileRandom()
{
if (Context.GetSync() is JNSSTileServerService tileServer)
{
return new LVector3(
Random.Float(tileServer.MinContains.x,tileServer.MaxContains.x),
LFloat.Zero,
Random.Float(tileServer.MinContains.y,tileServer.MaxContains.y)
);
}
return LVector3.Down;
}
2024-09-23 03:50:27 +08:00
public override void TileSyncData(ISTileData data)
{
Transform.Position = data.GetDataPosition();
}
public override void OnTileSlaveExit()
{
base.OnTileSlaveExit();
//从服务器 - 实体移出后立即删除
Destroy();
}
2024-08-31 21:05:29 +08:00
}
}