예제 #1
0
 void Awake()
 {
     if (mInstance == null)
     {
         mInstance = this as FadeCamera;
         instance.init();
     }
 }
예제 #2
0
    private IEnumerator WaitSceneToLoad(Scene sceneToWaitFor, bool fadeIn)
    {
        while (sceneToWaitFor.isLoaded == false)
        {
            yield return(null);
        }

        IsLoadingScene = false;

        if (fadeIn && fadeCameraInstance != null)
        {
            FadeCamera.FadeIn();
        }
    }
예제 #3
0
    public void SelectCurrentLevel(int chapterIndex, int levelIndex, bool useFadeEffect = false)
    {
        currentLevel.x        = chapterIndex;
        currentLevel.y        = levelIndex;
        timeSinceLevelStarted = Time.time;

        // We know this is a bonus level, because we are the only one sending -100 as a value for the chapter index
        StartCoroutine(chapterIndex == -100 ? LoadBonusChapterArt() : LoadNextChapterArt(currentLevel));

        if (useFadeEffect)
        {
            FadeCamera.FadeIn();
        }

        SetLastPlayedLevel();
    }
예제 #4
0
 public LoadingRoom(GameMap map)
 {
     Name = "LoadingRoom for map " + map.Number;
     Map  = map;
     AddChild(ARVROrigin            = new ARVROrigin());
     ARVROrigin.AddChild(ARVRCamera = new FadeCamera()
     {
         Current = true,
     });
     ARVROrigin.AddChild(LeftController = new ARVRController()
     {
         ControllerId = 1,
     });
     ARVROrigin.AddChild(RightController = new ARVRController()
     {
         ControllerId = 2,
     });
     if (Assets.LoadingPic is ImageTexture pic && pic != null)
     {
         ARVRCamera.AddChild(new MeshInstance()
         {
             Mesh = new QuadMesh()
             {
                 Size = new Vector2(pic.GetWidth() * Assets.PixelWidth, pic.GetHeight() * Assets.PixelHeight),
             },
             MaterialOverride = new SpatialMaterial()
             {
                 AlbedoTexture            = pic,
                 FlagsUnshaded            = true,
                 FlagsDoNotReceiveShadows = true,
                 FlagsDisableAmbientLight = true,
                 FlagsTransparent         = false,
                 ParamsCullMode           = SpatialMaterial.CullMode.Back,
                 ParamsSpecularMode       = SpatialMaterial.SpecularMode.Disabled,
             },
             Transform = new Transform(Basis.Identity, Vector3.Forward * pic.GetWidth() * Assets.PixelWidth),
         });
         AmbientTasks.Add(Task.Run(Loading));
     }
 }
예제 #5
0
 void OnApplicationQuit()
 {
     mInstance = null;
 }
예제 #6
0
 void Die()
 {
     mInstance = null;
     Destroy(gameObject);
 }
예제 #7
0
    private IEnumerator LoadGameLevelWithFade(string levelToLoad, bool setAsCurrentLevel, bool setAsActiveLevel, bool useFadeEffect = false, bool unloadOtherScenes = false)
    {
        if (useFadeEffect)
        {
            FadeCamera.FadeOut();

            while (FadeCamera.CurrentFadeLevel < 1f)
            {
                yield return(null);
            }
        }

        SceneManager.LoadScene(levelToLoad, LoadSceneMode.Additive);

        if (setAsCurrentLevel)
        {
            SelectCurrentLevel(levelToLoad);
        }

        Scene sceneToLoad = SceneManager.GetSceneByName(levelToLoad);

        if (setAsCurrentLevel)
        {
            CurrentGameScene = sceneToLoad;
        }

        while (sceneToLoad.isLoaded == false)
        {
            yield return(null);
        }

        if (setAsActiveLevel)
        {
            SceneManager.SetActiveScene(sceneToLoad);
        }

        if (unloadOtherScenes)
        {
            for (int i = 0; i < SceneManager.sceneCount; i++)
            {
                Scene sceneToUnload = SceneManager.GetSceneAt(i);

                if (sceneToUnload.buildIndex == sceneToLoad.buildIndex)
                {
                    continue;
                }

                SceneManager.UnloadSceneAsync(sceneToUnload);
            }
        }

        yield return(null);

        if (useFadeEffect)
        {
            FadeCamera.FadeIn();

            while (FadeCamera.CurrentFadeLevel > 0f)
            {
                yield return(null);
            }
        }

        IsLoadingScene = false;
    }
 void Start()
 {
     this._player = GameObject.FindWithTag("Player");
     this._scriptFade = GetComponent<FadeCamera>();
     this._cameraPit = GameObject.Find("Camera-Pit");
     this._cameraStairsLeft = GameObject.Find("Camera-Stairs-Left");
     this._cameraStairsRight = GameObject.Find("Camera-Stairs-Right");
     this._cameraRing = GameObject.Find("Camera-Ring");
     this._timeToShowCamera = TIMETOSHOWCAMERA;
     this._cameraPit.camera.enabled = false;
     this._cameraStairsLeft.camera.enabled = false;
     this._cameraStairsRight.camera.enabled = false;
     this._cameraRing.camera.enabled = false;
     this._canFade = false;
     this._cameraPitStoppedGame = false;
     this._cameraStairsLeftStoppedGame = false;
     this._cameraStairsRightStoppedGame = false;
 }