using UnityEngine; namespace VelNetUnity { public abstract class NetworkComponent : MonoBehaviour { public NetworkObject networkObject; protected bool IsMine => networkObject != null && networkObject.owner != null && networkObject.owner.isLocal; protected NetworkPlayer Owner => networkObject != null ? networkObject.owner : null; /// /// call this in child classes to send a message to other people /// protected void SendBytes(byte[] message, bool reliable = true) { networkObject.SendBytes(this, message, reliable); } /// /// call this in child classes to send a message to other people /// protected void SendBytesToGroup(string group, byte[] message, bool reliable = true) { networkObject.SendBytesToGroup(this, group, message, reliable); } // /// /// This is called by when messages are received for this component /// public abstract void ReceiveBytes(byte[] message); } }