public void SetLevelCurrency() { if (m_collectedCurrencyList != null) { int coinsCollected = m_collectedCurrencyList[GameController.Instance.m_level]; Blocks.Level level = Blocks.BlockSpawner.LoadLevel(GameController.Instance.m_level); string text = (level != null && coinsCollected >= 0) ? coinsCollected.ToString() + "/" + level.m_currencyCount.ToString() : "???"; in_levelcurrencyCounter.text = text; } }
public int CoinsCollectedInLevel(int levelID) { bool output; SaveData levelData = new SaveData(levelID.ToString(), out output); Blocks.Level level = Blocks.BlockSpawner.LoadLevel(levelID); if (level == null) { return(-1); } int coinsCollected = 0; for (int i = 0; i < level.m_currencyCount; i++) { if (levelData.IsCoinCollected(i)) { coinsCollected++; } } return(coinsCollected); }