Пример #1
0
        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);
            }
        }
Пример #2
0
    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");
    }
Пример #3
0
    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;
    }