KinectManager.OnCalibrationSuccess C# (CSharp) Method

OnCalibrationSuccess() public method

public OnCalibrationSuccess ( uint UserId ) : void
UserId uint
return void
    void OnCalibrationSuccess(uint UserId)
    {
        Debug.Log(String.Format("[{0}] Calibration success", UserId));

        // If player 1 hasn't been calibrated, assign that UserID to it.
        if(!Player1Calibrated)
        {
            // Check to make sure we don't accidentally assign player 2 to player 1.
            if (UserId != Player2ID)
            {
                Player1Calibrated = true;
                Player1ID = UserId;

                foreach(AvatarController controller in Player1Controllers)
                {
                    controller.SuccessfulCalibration(UserId);
                }

                // If we're not using 2 users, we're all calibrated.
                if(!TwoUsers)
                {
                    AllPlayersCalibrated = true;
                }
            }
        }
        // Otherwise, assign to player 2.
        else
        {
            if (UserId != Player1ID)
            {
                Player2Calibrated = true;
                Player2ID = UserId;

                foreach(AvatarController controller in Player2Controllers)
                {
                    controller.SuccessfulCalibration(UserId);
                }

                // All users are calibrated!
                AllPlayersCalibrated = true;
            }
        }

        // If all users are calibrated, stop trying to find them.
        if(AllPlayersCalibrated)
        {
            Debug.Log("");

            if(CalibrationText != null)
            {
                CalibrationText.guiText.text = "";
            }

            KinectWrapper.StopLookingForUsers();
        }
    }