示例#1
0
 // called on client
 public virtual bool stateRepReceive(ushort varOffset, byte[] src, ref int offset)
 {
     if (varOffset == 0)
     {
         owner = ClientTest.deserializeToInt(src, ref offset);
         return(true);
     }
     else if (varOffset == 1)
     {
         goId = ClientTest.deserializeToInt(src, ref offset);
         return(true);
     }
     return(false);
 }
    /** rpc reception method(client)*/

    public override bool rpcReceive(ushort rpc_id, byte[] src, ref int offset)
    {
        if (base.rpcReceive(rpc_id, src, ref offset))
        {
            return(true);
        }
        switch (rpc_id)
        {
        case 64:
        {
            UnityEngine.Vector3 pos = ClientTest.deserializeToVector3(src, ref offset); UnityEngine.Vector3 rot = ClientTest.deserializeToVector3(src, ref offset); System.Single estTime = ClientTest.deserializeToFloat(src, ref offset); UnityEngine.Vector3 _frameVelocity = ClientTest.deserializeToVector3(src, ref offset); System.Byte interpolationMode = ClientTest.deserializeToByte(src, ref offset); ReceiveUpdate(pos, rot, estTime, _frameVelocity, interpolationMode);
        }
        break;


        case 65:
        {
            UnityEngine.Vector3 pos = ClientTest.deserializeToVector3(src, ref offset); UnityEngine.Vector3 rot = ClientTest.deserializeToVector3(src, ref offset); System.Single estTime = ClientTest.deserializeToFloat(src, ref offset); UnityEngine.Vector3 _frameVelocity = ClientTest.deserializeToVector3(src, ref offset); System.Byte interpolationMode = ClientTest.deserializeToByte(src, ref offset); ReceiveUpdateFromHost(pos, rot, estTime, _frameVelocity, interpolationMode);
        }
        break;


        case 66:
        {
            System.Int32 id = ClientTest.deserializeToInt(src, ref offset); PingServer(id);
        }
        break;


        case 67:
        {
            System.Int32 id = ClientTest.deserializeToInt(src, ref offset); PingClient(id);
        }
        break;
        }
        return(true);
    }