mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 11:24:46 +00:00
46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using DotRecast.Core.Collections;
|
|
using Game.Input;
|
|
using Game.JNGFrame.Logic.Entity;
|
|
using Game.JNGFrame.Logic.Entity.Contexts;
|
|
using JNGame.Math;
|
|
using JNGame.Sync.Frame.Service;
|
|
using JNGame.Sync.System;
|
|
using UnityEngine;
|
|
|
|
namespace Game.Logic.System
|
|
{
|
|
/// <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 != null && idWorld.IsPlayerCreate)
|
|
{
|
|
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);
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
}
|
|
} |