예제 #1
0
        public void ResetMainCameraWillEnableTheInitialMainCamera()
        {
            Camera initialCam = ComponentCreator.Create <Camera>();
            Camera sceneCam   = ComponentCreator.Create <Camera>();


            ICameraController stubController = Substitute.For <ICameraController>();

            stubController.FetchAttachedCamera().Returns(sceneCam);
            stubController.FetchCameras().Returns(new [] { initialCam, sceneCam });
            stubController.FetchMainCamera().Returns(initialCam);

            initialCam.enabled = true;
            sceneCam.enabled   = true;

            MainCameraSwitcherLogic logic = new MainCameraSwitcherLogic();

            logic.SetCameraController(stubController);
            logic.Initialize();

            Assert.IsFalse(initialCam.enabled);
            Assert.IsTrue(sceneCam.enabled);

            logic.ResetMainCamera();


            Assert.IsTrue(initialCam.enabled);
            Assert.IsFalse(sceneCam.enabled);
        }
예제 #2
0
 private void OnDestroy()
 {
     logic.ResetMainCamera();
 }