mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
@@ -7,6 +7,13 @@ namespace JNGame.Sync.Frame.Entity.Component.Components
|
||||
{
|
||||
public class JNTransformComponent : JNComponent
|
||||
{
|
||||
|
||||
public LVector3 Position = new();
|
||||
|
||||
public bool IsRange(LVector3 target,LFloat len)
|
||||
{
|
||||
return LVector3.Distance(Position, target) <= len;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -24,7 +24,7 @@ namespace JNGame.Sync.Entity.Component
|
||||
|
||||
//生命周期
|
||||
public virtual void OnSyncStart(){}
|
||||
public virtual void OnSyncUpdate(){}
|
||||
public virtual void OnSyncUpdate(int dt){}
|
||||
public virtual void OnSyncDestroy(){}
|
||||
}
|
||||
}
|
@@ -88,7 +88,7 @@ namespace JNGame.Sync.Frame.Entity
|
||||
return entity;
|
||||
}
|
||||
|
||||
public sealed override T CreateEntity()
|
||||
public override T CreateEntity()
|
||||
{
|
||||
var entity = NewEntity();
|
||||
BindInitialize(entity);
|
||||
@@ -100,14 +100,14 @@ namespace JNGame.Sync.Frame.Entity
|
||||
//帧同步 生命周期
|
||||
public virtual void OnSyncStart(){}
|
||||
|
||||
public virtual void OnSyncUpdate()
|
||||
public virtual void OnSyncUpdate(int dt)
|
||||
{
|
||||
//给实体推帧
|
||||
foreach (var entity in GetEntities())
|
||||
{
|
||||
if (entity.isEnabled)
|
||||
{
|
||||
entity.OnSyncUpdate();
|
||||
entity.OnSyncUpdate(dt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ namespace JNGame.Sync.Entity
|
||||
{
|
||||
for (var i = 0; i < allContexts.Length; i++)
|
||||
{
|
||||
(allContexts[i] as IJNContext)?.OnSyncUpdate();
|
||||
(allContexts[i] as IJNContext)?.OnSyncUpdate(Sync.DeltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -136,12 +136,12 @@ namespace JNGame.Sync.Entity
|
||||
//生命周期
|
||||
public virtual void OnSyncStart(){}
|
||||
|
||||
public virtual void OnSyncUpdate()
|
||||
public virtual void OnSyncUpdate(int dt)
|
||||
{
|
||||
//给组件推帧
|
||||
foreach (var component in GetComponents())
|
||||
{
|
||||
(component as JNComponent)?.OnSyncUpdate();
|
||||
(component as JNComponent)?.OnSyncUpdate(dt);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user