コード例 #1
0
    private void ConfigureRaycastQuery(string queryType)
    {
        DCLCharacterController.i.SetPosition(startPos);

        raycastQuery                 = new PB_RayQuery();
        raycastQuery.QueryId         = "123456" + queryType;
        raycastQuery.QueryType       = queryType;
        raycastQuery.Ray             = new PB_Ray();
        raycastQuery.Ray.Direction   = new PB_Vector3();
        raycastQuery.Ray.Direction.X = Vector3.back.x;
        raycastQuery.Ray.Direction.Y = Vector3.back.y;
        raycastQuery.Ray.Direction.Z = Vector3.back.z;
        raycastQuery.Ray.Distance    = 1000;
        raycastQuery.Ray.Origin      = new PB_Vector3();
        raycastQuery.Ray.Origin.X    = startPos.x;
        raycastQuery.Ray.Origin.Y    = startPos.y;
        raycastQuery.Ray.Origin.Z    = startPos.z;

        query         = new PB_Query();
        query.QueryId = "raycast";
        query.Payload = System.Convert.ToBase64String(raycastQuery.ToByteArray());

        sendSceneMessage         = new PB_SendSceneMessage();
        sendSceneMessage.Query   = query;
        sendSceneMessage.SceneId = this.scene.sceneData.id;
    }
コード例 #2
0
        public static void DecodeQueryMessage(string queryId, string payload, ref QueryMessage query)
        {
#if UNITY_EDITOR
            DumpMessage(payload, QUERY_FILENAME, ref queryDumpStr, ref queryCount);
#endif

            byte[]      bytes      = System.Convert.FromBase64String(payload);
            PB_RayQuery pbRayQuery = PB_RayQuery.Parser.ParseFrom(bytes);

            query.queryType             = queryId;
            query.payload               = new RaycastQuery();
            query.payload.id            = pbRayQuery.QueryId;
            query.payload.raycastType   = Protocol.RaycastLiteralToType(pbRayQuery.QueryType);
            query.payload.ray           = new DCL.Models.Ray();
            query.payload.ray.direction = new Vector3(pbRayQuery.Ray.Direction.X, pbRayQuery.Ray.Direction.Y, pbRayQuery.Ray.Direction.Z);
            query.payload.ray.distance  = pbRayQuery.Ray.Distance;
            query.payload.ray.origin    = new Vector3(pbRayQuery.Ray.Origin.X, pbRayQuery.Ray.Origin.Y, pbRayQuery.Ray.Origin.Z);
        }