void Update() { if (dbManager == null) { if (GetComponent <SimpleSQL.SimpleSQLManager>()) { dbManager = GetComponent <SimpleSQL.SimpleSQLManager>(); } } if (dbManager != null && tileFades == null) { GenTileFades(); //generates random colors for tile aesthetics. ReadLevelStates(); } if (dbManager != null && currentStars == -1) { LoadStartingData(); } if (playingIntro && !source.isPlaying) { playingIntro = false; source.clip = Music[1]; source.loop = true; source.Play(); } if (giveHint) { AddHint(); giveHint = false; } if (lastAdd > 8) { ShowRewardedVideo(); } if (unlockState == true) { unlockState = false; this.UpdateState(this.currentLevel + 1, 1); this.NextLevel(); } }
//queries levelstates from database. (01234) are possible staetes. void ReadLevelStates() { if (dbManager == null) { if (GetComponent <SimpleSQL.SimpleSQLManager>()) { dbManager = GetComponent <SimpleSQL.SimpleSQLManager>(); } } levelStates = new Dictionary <int, LevelStateInfo>(); List <Level> levels = dbManager.Query <Level>("SELECT L.LevelNumber, L.LevelState, L.HintsUnlocked FROM ZenLevels L"); for (int a = 0; a < levels.Count; a++) { levelStates[levels[a].LevelNumber] = new LevelStateInfo(levels[a].LevelNumber, levels[a].LevelState, levels[a].HintsUnlocked); } }
void Start() { if (dbManager == null) { if (GetComponent <SimpleSQL.SimpleSQLManager>()) { dbManager = GetComponent <SimpleSQL.SimpleSQLManager>(); } } source = GetComponent <AudioSource>(); source.clip = Music[0]; playingIntro = true; source.Play(); Advertisement.Initialize("1595089"); GenTileFades(); //generates random colors for tile aesthetics. ReadLevelStates(); }