breakpoint

This commit is contained in:
CortexCore
2023-06-17 16:30:53 +08:00
parent cd02761be7
commit 877ba6e548
88 changed files with 8715 additions and 988 deletions

View File

@@ -82,7 +82,7 @@ namespace BITFALL.Entites
{
lookInput = MathV.TransientRotationAxis(transform.eulerAngles);
}
public override async void OnStart()
public override void OnStart()
{
foreach (var state in characterStates)
{
@@ -99,9 +99,6 @@ namespace BITFALL.Entites
inputActionGroup.RegisterCallback(crouchAction, OnCrouch);
entity.AddListener<IMovementCancelAction>(CancelMovement);
client = await DI.GetAsync<ClientBase>();
client.AddRpcHandle(this);
}
public override void OnSpawn()
{

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@@ -7,20 +8,22 @@ using BITKit;
using BITKit.Entities;
using BITKit.SubSystems;
using Net.Share;
using Unity.Mathematics;
namespace BITFALL
{
public class MovementService : SubBITSystem
public class KinematicMovementService : MonoBehaviour
{
public override void OnCreate()
[SerializeField, SerializeReference, SubclassSelector]
private INetProvider netProvider;
private void Start()
{
BITNet.AddRpcHandle(this);
}
[Rpc]
public void SyncMovement(int entityId, Net.Vector3 currentVelocity, Net.Vector3 currentPos,Net.Quaternion currentRot,bool isGrounded)
public void SyncMovement(int entityId, float3 currentVelocity, float3 currentPos,quaternion currentRot,bool isGrounded)
{
try
{
EntitiesManager
UnityEntitiesManager
.GetOrAdd(entityId)
.Get<IEntityMovement>()
.SyncMovement(currentVelocity, currentPos, currentRot,isGrounded);
@@ -28,7 +31,7 @@ namespace BITFALL
catch (System.Exception e)
{
StringBuilder stringBuilder = new();
var entity = EntitiesManager.GetOrAdd(entityId);
var entity = UnityEntitiesManager.GetOrAdd(entityId);
stringBuilder.AppendLine($"Entity:{entityId}@{entity}");
var movement = entity.Get<IEntityMovement>();
stringBuilder.AppendLine($"Movement@{movement}");

View File

@@ -1,32 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Net.Share;
using BITKit;
using BITKit.Entities;
using Net.Client;
namespace BITFALL.Entites
{
[CreateOnStart(BITAppForUnity.Path.Services,nameof(NetEntitesManager))]
public class NetEntitesManager : MonoBehaviour
{
public Entity proxy;
async void Start()
{
EntitiesManager.CreateFactory = CreateFactory;
var client = await DI.GetAsync<ClientBase>();
client.AddRpcHandle(this);
}
[Rpc]
public void RpcEntityHeartbeat(int entityId)
{
var entity = EntitiesManager.GetOrAdd(entityId, CreateFactory);
}
IEntity CreateFactory(int id)
{
var entity = Instantiate(proxy);
entity.Id = id;
return entity;
}
}
}

View File

@@ -11,11 +11,15 @@ namespace BITFALL.Entites
{
public class EntityGDNetPlayer : EntityComponent
{
[SerializeField, SerializeReference, SubclassSelector]
private INetClient netClient;
[SerializeField, SerializeReference, SubclassSelector]
private INetProvider netProvider;
public override void OnStart()
{
entity.Id = Guid.NewGuid().GetHashCode();
BITNet.OnConnected+=OnConnected;
BITNet.OnDisconnect += OnDisconnect;
netClient.OnConnected+=OnConnected;
netClient.OnDisconnected += OnDisconnect;
IEntity.LocalPlayer = entity;
IEntity.OnSpawnLocalPlayer(entity);
}

View File

@@ -13,7 +13,6 @@ namespace BITFALL.Entites
{
public override void OnCreate()
{
BITNet.AddRpcHandle(this);
}
}
}