public void StartGame() { Cursor = Instantiate(CursorGameObject.gameObject).GetComponent <Cursor>(); _currentLevel = Instantiate(LevelGameObject.gameObject).GetComponent <Level>(); _currentLevel.OnNextLevelReady += NextLevelReady; _currentLevel.Init(); Cursor.OnNewTurn += NextLevel; ScoreManager = new ScoreManager(Gauge, ScoreText); ScoreManager.OnGameOver += GameOver; for (var i = 0; i < Colors.Length; i++) { Buttons[i].gameObject.GetComponent <Image>().color = Colors[i]; var color = Colors[i]; } _startChecking = true; }
public Level GetLevel(int levelNum) { if (levelNum < 1 && levelNum >= m_levels.Count) throw new Exception ( "Level " + levelNum + " not exists." ); string fileName = m_levels[levelNum - 1]; string gameDir = GameManager.Instance.GameDirectory; JSONObject jsonObject = TextLoader.GetFileAsJson ( gameDir, fileName ); var level = new Level ( ) { Number = levelNum }; level.Load ( jsonObject ); level.Init(); if (OnLevelChange != null) OnLevelChange.Invoke(level); return level; }