Exemplo n.º 1
0
 void LateUpdate()
 {
     if (currentMode == Mode.followPlayer)
     {
         transform.position = GetCameraPositionInPlayerMode();
     }
     else if (currentMode == Mode.transitionToTetris)
     {
         float progress = (Time.time - transitionStartTime) / timeToTransitionToTetris;
         if (progress < 1)
         {
             transform.position = Vector3.Lerp(transform.position, endPosition, (Time.time - transitionStartTime) / timeToTransitionToTetris);
         }
         else
         {
             currentMode = Mode.tetris;
             EventManager.TriggerEvent(Constants.cameraWatchingTetrisEvent, TetrisLevelMessage.CreateHashtable(currentLevel));
         }
     }
     else if (currentMode == Mode.transitionToPlayer)
     {
         float progress = (Time.time - transitionStartTime) / timeToTransitionToTetris;
         if (progress < 1)
         {
             transform.position = Vector3.Lerp(transform.position, endPosition, (Time.time - transitionStartTime) / timeToTransitionToPlayer);
         }
         else
         {
             currentMode = Mode.followPlayer;
             EventManager.TriggerEvent(Constants.cameraFollowingPlayerEvent);
         }
     }
 }
Exemplo n.º 2
0
 void Update()
 {
     if (FlickedSwitch())
     {
         EventManager.TriggerEvent(Constants.tetrisEvent, TetrisLevelMessage.CreateHashtable(level));
         canBeFlicked          = false;
         spriteRenderer.sprite = on;
         showE.SetActive(false);
     }
 }