using UdonSharp;

namespace Marro.PacManUdon
{
    public abstract class SyncedObject : UdonSharpBehaviour
    {
        public NetworkManager networkManager;

        public virtual void SyncedUpdate() { }
        public virtual void CollectSyncedData(byte[] data, ref int index, NetworkEventType eventType) { }
        public virtual bool WriteSyncedData(byte[] data, ref int index, NetworkEventType eventType) { return false; }

        protected void SubscribeToEvent(NetworkEventType eventType) => networkManager.SubscribeToEvent(this, eventType);
    }
}