44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using System.Text;
|
|
using Net.Client;
|
|
using BITKit;
|
|
using BITKit.Entities;
|
|
using BITKit.SubSystems;
|
|
using Net.Share;
|
|
using Unity.Mathematics;
|
|
namespace BITFALL
|
|
{
|
|
public class KinematicMovementService : MonoBehaviour
|
|
{
|
|
[SerializeField, SerializeReference, SubclassSelector]
|
|
private INetProvider netProvider;
|
|
private void Start()
|
|
{
|
|
|
|
}
|
|
public void SyncMovement(int entityId, float3 currentVelocity, float3 currentPos,quaternion currentRot,bool isGrounded)
|
|
{
|
|
try
|
|
{
|
|
UnityEntitiesManager
|
|
.GetOrAdd(entityId)
|
|
.Get<IEntityMovement>()
|
|
.SyncMovement(currentVelocity, currentPos, currentRot,isGrounded);
|
|
}
|
|
catch (System.Exception e)
|
|
{
|
|
StringBuilder stringBuilder = new();
|
|
var entity = UnityEntitiesManager.GetOrAdd(entityId);
|
|
stringBuilder.AppendLine($"Entity:{entityId}@{entity}");
|
|
var movement = entity.Get<IEntityMovement>();
|
|
stringBuilder.AppendLine($"Movement@{movement}");
|
|
BIT4Log.Warnning(stringBuilder);
|
|
Debug.LogException(e);
|
|
}
|
|
|
|
}
|
|
}
|
|
} |