using UnityEngine; namespace VelNet { public abstract class NetworkComponent : MonoBehaviour { public NetworkObject networkObject; protected bool IsMine => networkObject != null && networkObject.owner != null && networkObject.owner.isLocal; protected VelNetPlayer 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); } }