This commit is contained in:
2025-08-31 20:46:27 +02:00
parent 2d06552025
commit 104259f79b
11 changed files with 310 additions and 137 deletions

View File

@@ -10,6 +10,7 @@ using Unity.Collections;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.ResourceManagement.AsyncOperations;
using Logger = RebootKit.Engine.Foundation.Logger;
namespace RebootKit.Engine.Simulation {
@@ -233,16 +234,17 @@ namespace RebootKit.Engine.Simulation {
}
}
[DeclareFoldoutGroup("Actor")]
public abstract class Actor : MonoBehaviour {
static readonly Logger s_ActorLogger = new Logger(nameof(Actor));
[field: SerializeField, TriInspector.ReadOnly] public string SourceActorPath { get; internal set; } = "";
[field: SerializeField, TriInspector.ReadOnly] public ulong ActorStaticID { get; internal set; }
[field: SerializeField, TriInspector.ReadOnly] public ushort ActorID { get; internal set; }
[field: SerializeField, TriInspector.ReadOnly, Group("Actor")] public string SourceActorPath { get; internal set; } = "";
[field: SerializeField, TriInspector.ReadOnly, Group("Actor")] public ulong ActorStaticID { get; internal set; }
[field: SerializeField, TriInspector.ReadOnly, Group("Actor")] public ushort ActorID { get; internal set; }
[NonSerialized] internal IActorData Data;
[SerializeField] string m_ActorName = "";
[SerializeField, Group("Actor")] string m_ActorName = "";
public string ActorName {
get {
@@ -252,20 +254,20 @@ namespace RebootKit.Engine.Simulation {
internal bool IsLocalOnly;
[SerializeField] internal Rigidbody actorRigidbody;
[SerializeField, Group("Actor")] internal Rigidbody actorRigidbody;
[InfoBox("If empty, will use GetComponentsInChildren<Collider>() to find colliders.")]
[SerializeField] Collider[] m_OverrideActorColliders;
[SerializeField, Group("Actor")] Collider[] m_OverrideActorColliders;
[SerializeField] bool m_SetKinematicOnMount = true;
[SerializeField] bool m_DisableCollidersOnMount = true;
[SerializeField, Group("Actor")] bool m_SetKinematicOnMount = true;
[SerializeField, Group("Actor")] bool m_DisableCollidersOnMount = true;
internal ActorFlags Flags = ActorFlags.None;
// @NOTE: Sync won't happen if actor is mounted to another actor.
[SerializeField] internal bool syncTransform = true;
[SerializeField] internal bool syncPosition = true;
[SerializeField] internal bool syncRotation = true;
[SerializeField] internal bool syncScale = false;
[SerializeField, Group("Actor")] internal bool syncTransform = true;
[SerializeField, Group("Actor")] internal bool syncPosition = true;
[SerializeField, Group("Actor")] internal bool syncRotation = true;
[SerializeField, Group("Actor")] internal bool syncScale = false;
class ActorClientState {
public ulong LastSyncTick;
@@ -286,7 +288,7 @@ namespace RebootKit.Engine.Simulation {
public Quaternion localRotation;
}
[SerializeField] AttachmentSocket[] m_AttachmentSockets;
[SerializeField, Group("Actor")] AttachmentSocket[] m_AttachmentSockets;
// @NOTE: Master actor is the actor that this actor is attached to, if any.
internal Actor MasterActor;
@@ -296,6 +298,8 @@ namespace RebootKit.Engine.Simulation {
public bool IsDataDirty { get; protected internal set; }
internal ActorsManager Manager;
internal AsyncOperationHandle<GameObject> AssetHandle;
internal DateTime LastCoreStateSyncTime = DateTime.MinValue;
//