public void InvokeRpc(string methodName, RpcArgs args, int priority) { NetworkMessage.RpcInvokeMessage rpcDef = new NetworkMessage.RpcInvokeMessage(instanceId, priority, methodName, args); if (ClientStage.active) { ClientStage.SendNetworkMessage(rpcDef); } if (ServerStage.active) { ServerStage.SendNetworkMessage(rpcDef); } }
public void RequestPlayerSpawn() { if (!ClientStage.active) { return; } //Debug.Log("Sending spawn message"); NetworkMessage.SpawnPlayerMessage msg = new NetworkMessage.SpawnPlayerMessage(); ClientStage.SendNetworkMessage(msg); //Debug.Log("Done sending spawn message"); }
public void InvokePositionUpdate() { if (ClientStage.active && !myNetworkEntity.IsLocalObject()) { return; } NetworkMessage.UpdateTransformMessage transformMsg = new NetworkMessage.UpdateTransformMessage(myNetworkEntity.instanceId, transform.position, transform.rotation, childTransform.localPosition, childTransform.rotation, _velocity); if (ClientStage.active) { ClientStage.SendNetworkMessage(transformMsg); } if (ServerStage.active) { ServerStage.SendNetworkMessage(transformMsg); } previousPosition = transform.position; previousRotation = transform.rotation; previousChildPosition = childTransform.localPosition; previousChildRotation = childTransform.rotation; }