KinectManager.OnUserLost C# (CSharp) Method

OnUserLost() public method

public OnUserLost ( uint UserId ) : void
UserId uint
return void
    void OnUserLost(uint UserId)
    {
        Debug.Log(String.Format("[{0}] User lost", UserId));

        // If we lose player 1...
        if(UserId == Player1ID)
        {
            // Null out the ID and reset all the models associated with that ID.
            Player1ID = 0;

            foreach(AvatarController controller in Player1Controllers)
            {
                controller.RotateToCalibrationPose(UserId, IsCalibrationNeeded());
            }

            // Try to replace that user!
            Debug.Log("Starting to look for users");
            KinectWrapper.StartLookingForUsers(NewUser, CalibrationStarted, CalibrationFailed, CalibrationSuccess, UserLost);
        }

        // If we lose player 2...
        if(UserId == Player2ID)
        {
            // Null out the ID and reset all the models associated with that ID.
            Player2ID = 0;

            foreach(AvatarController controller in Player2Controllers)
            {
                controller.RotateToCalibrationPose(UserId, IsCalibrationNeeded());
            }

            // Try to replace that user!
            Debug.Log("Starting to look for users");
            KinectWrapper.StartLookingForUsers(NewUser, CalibrationStarted, CalibrationFailed, CalibrationSuccess, UserLost);
        }

        // remove from global users list
        allUsers.Remove(UserId);
    }