// Start is called before the first frame update private void Start() { string savedColorPalette = PlayerPrefs.GetString("ColorPalette"); _currentColorPalette = savedColorPalette != "" ? Resources.Load <ColorPalette>("ColorPalettes/" + savedColorPalette) : Resources.Load <ColorPalette>("ColorPalettes/Day"); _gameBoard = FindObjectOfType <Board>(); _spawner = FindObjectOfType <Spawner>(); _uiManager = FindObjectOfType <UIManager>(); _scoreManager = FindObjectOfType <ScoreManager>(); // If the game is restarted we don't need main menu displayed again if (_isRestarted) { _uiManager.CloseMainMenu(); _isRestarted = false; SoundManager.Instance.PlayStartSound(); } _mainCamera = Camera.main; if (!_mainCamera) { Debug.Log("Cant get main camera"); return; } _shapesInPlay = new Shape[3]; _numberOfShapesInPlay = _shapesInPlay.Length; _scoreManager.SetHighScore(PlayerPrefs.GetInt("highScore")); _uiManager.SetHighScoreUI(_scoreManager.GetHighScore()); _uiManager.SetMainMenuHighScoreUI(_scoreManager.GetHighScore()); if (!_gameBoard) { Debug.LogWarning("There is no game board"); return; } if (!_spawner) { Debug.LogWarning("There is no spawner"); return; } // Spawn first 3 shapes Shape spawnedShape = _spawner.SpawnShapeAtPositionWithScaleAndRandomRotation( new Vector3(1f, -3, -2), new Vector3(0.6f, 0.6f, 1.0f)); _shapesInPlay[0] = spawnedShape; spawnedShape = _spawner.SpawnShapeAtPositionWithScaleAndRandomRotation( new Vector3(4.5f, -3, -2), new Vector3(0.6f, 0.6f, 1.0f)); _shapesInPlay[1] = spawnedShape; spawnedShape = _spawner.SpawnShapeAtPositionWithScaleAndRandomRotation( new Vector3(8f, -3, -2), new Vector3(0.6f, 0.6f, 1.0f)); _shapesInPlay[2] = spawnedShape; ChangeGameColorPalette(_currentColorPalette); }