提交新概念 Tile从服务器

This commit is contained in:
PC-20230316NUNE\Administrator
2024-08-31 15:35:12 +08:00
parent 77db4d7d71
commit d67032e1de
1039 changed files with 57738 additions and 412 deletions

View File

@@ -0,0 +1,40 @@
using DotRecast.Core.Collections;
using Game.Input;
using Game.JNGFrame.Logic.Entity;
using Game.JNGFrame.Logic.Entity.Contexts;
using JNGame.Math;
namespace Game.Logic.System.Logic
{
/// <summary>
/// Boss逻辑
/// </summary>
public class DBossSystem : DGBasisSystem
{
//Node 节点
public EDBoss[] Nodes => NodeContext.GetHostEntities();
public EDBossContext NodeContext => Contexts.GetContext<EDBossContext>();
public DInputSystem Input => GetSystem<DInputSystem>();
public override void OnSyncUpdate()
{
base.OnSyncUpdate();
//创建Boss
GetSystem<DInputSystem>().SInput<IDWorld>().ForEach(child =>
{
var idWorld = (IDWorld)child.Value;
if (idWorld is { IsBossCreate: true })
{
var entity = NodeContext.CreateEntity();
entity.Move.SetPosition(GetTileRandom());
}
});
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b48944cb153b4e67809d2cddde1acc6b
timeCreated: 1724724224

View File

@@ -0,0 +1,43 @@
using DotRecast.Core.Collections;
using Game.Input;
using Game.JNGFrame.Logic.Entity;
using Game.JNGFrame.Logic.Entity.Contexts;
using JNGame.Math;
namespace Game.Logic.System.Logic
{
/// <summary>
/// 玩家逻辑
/// </summary>
public class DPlayerSystem : DGBasisSystem
{
//Node 节点
public EDPlayer[] Nodes => NodeContext.GetHostEntities();
public EDPlayerContext NodeContext => Contexts.GetContext<EDPlayerContext>();
public DInputSystem Input => GetSystem<DInputSystem>();
public override void OnSyncUpdate()
{
base.OnSyncUpdate();
//创建角色
GetSystem<DInputSystem>().SInput<IDWorld>().ForEach(child =>
{
var key = child.Key;
var idWorld = (IDWorld)child.Value;
if (idWorld is { IsPlayerCreate: true })
{
var entity = NodeContext.CreateEntity();
entity.Controller.AuthBind(key);
var spawn = new LVector3(Random.Float(0, 0),Random.Float(0, 0),Random.Float(0, 0));
entity.Move.SetPosition(spawn);
}
});
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7b59673517e1408295737003f44b2690
timeCreated: 1722224946

View File

@@ -0,0 +1,55 @@
using System.Collections.Generic;
using Game.Input;
using Game.JNGFrame.Logic.Entity;
using Game.JNGFrame.Logic.Entity.Contexts;
using JNGame.Math;
namespace Game.Logic.System.Logic
{
public class DWorldSystem : DGBasisSystem
{
//Node 节点
public EDNode[] Nodes => NodeContext.GetHostEntities();
public EDNodeContext NodeContext => Contexts.GetContext<EDNodeContext>();
//Node 第一个节点
public Queue<EDNode> NodeQueue = new();
public override void OnSyncUpdate()
{
base.OnSyncUpdate();
if (GetSystem<DInputSystem>().SInputOne<IDWorld>() is not IDWorld { IsAdd: true }) return;
//超过500 则 销毁第一个实体
if (Nodes.Length >= 100)
{
NodeQueue.Dequeue().Destroy();
return;
}
var max = 100;
EDNode entity;
if (IsTile())
{
entity = Contexts.GetContext<EDNodeContext>().CreateEntity();
entity.Move.SetPosition(GetTileRandom());
entity.Move.Go(GetTileRandom());
}
else
{
entity = Contexts.GetContext<EDNodeContext>().CreateEntity();
var spawn = new LVector3(Random.Float(0, max),Random.Float(0, 100),Random.Float(0, max));
entity.Move.SetPosition(spawn);
spawn = new LVector3(Random.Float(0, max),Random.Float(0, 100),Random.Float(0, max));
entity.Move.Go(spawn);
}
NodeQueue.Enqueue(entity);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 00e91648e3cd42a8ae1399000b88fdd6
timeCreated: 1712720318