using System.Collections;
using TMPro;
using UnityEngine;
///
/// Authorize and check for available webcam(s)
///
public class BootScreen : MonoBehaviour
{
///
/// UI Reference to the text object to display an error message
///
public TMP_Text errorText;
///
/// Reference to the list that holds all user avatars
///
public UserAvatarList sprites;
///
/// Request authorization and check whether at least 1 webcam is available
///
/// IEnumerator object
IEnumerator Start()
{
UserList.AVATARS = sprites.avatars;
PersistentDataController.GetInstance().Load();
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
if (Application.HasUserAuthorization(UserAuthorization.WebCam))
{
if (0 < WebCamTexture.devices.Length)
{
SystemController.GetInstance().SwapScene("Common/Scenes/MainMenuScreen");
}
else
{
errorText.text = "Zorg ervoor dat je webcam correct is aangesloten!";
}
}
else
{
errorText.text = "Zorg ervoor dat deze applicatie toegang heeft tot je webcam!";
}
}
}