コード例 #1
0
    /// <summary>
    /// Sends the specified SkeletonData over the network as a serializable skeleton (SSkleton) object.
    /// </summary>
    /// <param name="skeleton"> The SkeletonData object that must be sent. </param>
    public void SendSkeletonData(SkeletonData skeleton)
    {
        SJoint[]  serialJoints   = ScanSerializer.SerializeJoints(skeleton.jointPositions, skeleton.jointRotations);
        SBone[]   serialBones    = ScanSerializer.SerializeBones(skeleton.bonePositions, skeleton.boneRotations, skeleton.boneScales);
        SSkeleton serialSkeleton = new SSkeleton(serialJoints, serialBones);

        Debug.Log("SkSending");
        try
        {
            stream = client.GetStream();
            BinaryFormatter bf = new BinaryFormatter();
            bf.Serialize(stream, serialSkeleton);
            stream.Flush();
            Debug.Log("SkSent");
        }
        catch (SocketException e)
        {
            Debug.Log(e);
        }
    }