mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 10:46:17 +00:00
基础案例 准备改帧同步了
This commit is contained in:
@@ -7,6 +7,7 @@ namespace JNGame.Sync.Frame.Entity.Component.Components
|
||||
{
|
||||
|
||||
public LVector3 Position = new();
|
||||
public LVector3 Scale = new(1,1,1);
|
||||
|
||||
public bool IsRange(LVector3 target,LFloat len)
|
||||
{
|
||||
|
@@ -113,7 +113,9 @@ namespace JNGame.Sync.Frame.Entity
|
||||
}
|
||||
|
||||
//生命周期
|
||||
public virtual void OnSyncStart(){}
|
||||
public virtual void OnSyncStart()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnSyncUpdate(int dt)
|
||||
{
|
||||
@@ -128,7 +130,8 @@ namespace JNGame.Sync.Frame.Entity
|
||||
}
|
||||
|
||||
public virtual void OnSyncDestroy()
|
||||
{}
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public interface IJNContext : IJNSyncCycle
|
||||
|
@@ -39,13 +39,17 @@ namespace JNGame.Sync.Entity
|
||||
public JNEntityLookup CLookup{ get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 坐标
|
||||
/// Transform 组件
|
||||
/// </summary>
|
||||
public JNTransformComponent Transform => CLookup.Query<JNTransformComponent>(this);
|
||||
/// <summary>
|
||||
/// 位置
|
||||
/// </summary>
|
||||
public LVector3 Position => Transform.Position;
|
||||
/// <summary>
|
||||
/// 大小
|
||||
/// </summary>
|
||||
public LVector3 Scale => Transform.Scale;
|
||||
|
||||
public bool IsDelayDestroy { get; private set; } = false;
|
||||
|
||||
@@ -142,7 +146,9 @@ namespace JNGame.Sync.Entity
|
||||
}
|
||||
|
||||
//生命周期
|
||||
public virtual void OnSyncStart(){}
|
||||
public virtual void OnSyncStart()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void OnSyncUpdate(int dt)
|
||||
{
|
||||
|
@@ -4,8 +4,11 @@ using UnityEngine;
|
||||
|
||||
namespace JNGame.Sync.System.Data.Type
|
||||
{
|
||||
/// <summary>
|
||||
/// 用于传输的 LVector3 类型
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class DValuePosition
|
||||
public class NDataLVector3
|
||||
{
|
||||
public long x;
|
||||
public long y;
|
||||
@@ -23,7 +26,7 @@ namespace JNGame.Sync.System.Data.Type
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is not DValuePosition old) return false;
|
||||
if (obj is not NDataLVector3 old) return false;
|
||||
return old.x == x && old.y == y && old.z == z;
|
||||
}
|
||||
|
||||
@@ -32,9 +35,9 @@ namespace JNGame.Sync.System.Data.Type
|
||||
return new LVector3(new LFloat(true,x), new LFloat(true,y), new LFloat(true,z));
|
||||
}
|
||||
|
||||
public static DValuePosition Build(LVector3 vec3)
|
||||
public static NDataLVector3 Build(LVector3 vec3)
|
||||
{
|
||||
return new DValuePosition()
|
||||
return new NDataLVector3()
|
||||
{
|
||||
x = vec3.x.rawValue,
|
||||
y = vec3.y.rawValue,
|
@@ -1,5 +1,6 @@
|
||||
using GAS.Runtime;
|
||||
using JNGame.Sync.System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace JNGame.Runtime.Sync.System.Logic
|
||||
{
|
||||
@@ -14,10 +15,10 @@ namespace JNGame.Runtime.Sync.System.Logic
|
||||
/// </summary>
|
||||
private JexGasManager _gas = new();
|
||||
public JexGasManager GAS => _gas;
|
||||
|
||||
|
||||
public override void OnSyncUpdate(int dt)
|
||||
{
|
||||
GAS.Update();
|
||||
GAS.Update(dt);
|
||||
}
|
||||
|
||||
public void Register(AbilitySystemComponent abilitySystemComponent)
|
||||
|
Reference in New Issue
Block a user