Beispiel #1
0
    public CameraSwitcher(
        WebCamTextureToMatHelper toMatHelper,
        InvisibleConverter invCvtr,
        GameObject mainCanvas, GameObject camSwitchDialog)
    {
        _toMatHelper     = toMatHelper;
        _invCvtr         = invCvtr;
        _mainCanvas      = mainCanvas;
        _camSwitchDialog = camSwitchDialog;

        UseCamera = Convert.ToBoolean(PlayerPrefs.GetInt(USE_CAMERA_KEY, 0));
    }
    void Start()
    {
        Input.backButtonLeavesApp = true;
        Screen.sleepTimeout       = SleepTimeout.NeverSleep;

        _toMatHelper    = GetComponent <WebCamTextureToMatHelper>();
        _invCvtr        = new InvisibleConverter(_text);
        _cameraSwitcher = new CameraSwitcher(_toMatHelper, _invCvtr, _mainCanvas, _camSwitchDialog);
        _fpsMonitor     = GetComponent <FpsMonitor>();
        _recordSound    = GetComponent <AudioSource>();

        //リア/フロントをPlayerPrefabsから読み込む
        _toMatHelper.requestedIsFrontFacing = _cameraSwitcher.UseCamera;
        _toMatHelperMgr = new ToMatHelperManager(gameObject, _toMatHelper, _fpsMonitor);
        _toMatHelper.Initialize();

        //スマホの場合カメラ起動まで指定秒待つ
        #if !UNITY_EDITOR && UNITY_ANDROID
        Task.Run(WaitCamStartup).Wait();
        #endif
    }