void Update() { if (gameState.getCurrentProgress() != targetProgress) { targetProgress = gameState.getCurrentProgress(); setupAnimation(targetProgress); } }
private void setupAnimation(GameState.GameProgress newProgress) { CameraInfo info = cameraPositions.FirstOrDefault(arg => arg.progress == newProgress); if (info == null) { return; } iTween.MoveTo(gameObject, iTween.Hash( "x", info.x, "time", animationDuration, "easetype", iTween.EaseType.easeInOutExpo )); iTween.ValueTo(gameObject, iTween.Hash( "from", cam.orthographicSize, "to", info.size, "time", animationDuration, "easetype", iTween.EaseType.easeInOutExpo, "onupdate", "updateCameraSize" )); }