//Used to send events to other clients. If in single player, the event just get immedaitely received. public void SendEvent(BaseEntityEvent bee) { if (!connectedToHost) { DeliverEvent(bee); } //Do other stuff if connected }
//Used to take raw bytes and create a packet. Logic will be determined later. public void ReconstructEvent(byte[] bytes) { BaseEntityEvent bee = null; //Change later EVENT_TYPE type = EVENT_TYPE.MESSAGE; switch (type) { case EVENT_TYPE.MESSAGE: break; } if (bee != null) { DeliverEvent(bee); } }
//Invoke event upon reception public void DeliverEvent(BaseEntityEvent bee) { bee.InvokeEvent(); }