/// <summary> /// Called when a remote user sends a head transform. /// </summary> /// <param name="msg"></param> void UpdateChessTransform(NetworkInMessage msg) { // Parse the message long userID = msg.ReadInt64(); Vector3 headPos = CustomMessages.Instance.ReadVector3(msg); Quaternion headRot = CustomMessages.Instance.ReadQuaternion(msg); RemoteChessInfo headInfo = GetRemoteChessInfo(userID); headInfo.HeadObject.transform.localPosition = headPos; headInfo.HeadObject.transform.localRotation = headRot; }
/// <summary> /// Gets the data structure for the remote users' head position. /// </summary> /// <param name="userID"></param> /// <returns></returns> public RemoteChessInfo GetRemoteChessInfo(long userID) { RemoteChessInfo chessInfo; // Get the head info if its already in the list, otherwise add it if (!this.remoteHeads.TryGetValue(userID, out chessInfo)) { chessInfo = new RemoteChessInfo(); chessInfo.UserID = userID; chessInfo.HeadObject = CreateRemoteHead(); this.remoteHeads.Add(userID, chessInfo); } return(chessInfo); }