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); } } }
void StartTetris(Hashtable h) { currentIndex = 0; currentLevel = TetrisLevelMessage.GetLevelFromHashtable(h); RestartTetris(currentLevel); instantiatedCubes[currentLevel - 1] = new GameObject[NumberInGroup()]; transform.position = locations[currentLevel - 1].transform.position; SpawnNext(); }
void Update() { if (FlickedSwitch()) { EventManager.TriggerEvent(Constants.tetrisEvent, TetrisLevelMessage.CreateHashtable(level)); canBeFlicked = false; spriteRenderer.sprite = on; showE.SetActive(false); } }
void TetrisMode(Hashtable h) { currentMode = Mode.transitionToTetris; transitionStartTime = Time.time; currentLevel = TetrisLevelMessage.GetLevelFromHashtable(h); if (currentLevel == -1) { Debug.LogError("no location specified!"); } if (currentLevel > tetrisLocations.Length) { Debug.LogError("not enough tetris locations specified"); } // TODO lerp into tetris mode endPosition = tetrisLocations[currentLevel - 1].transform.position; }