void FillButtons()
{
gameObject.AddComponent<DatabaseHelper>();
DatabaseHelper database = GetComponent<DatabaseHelper>();
int levelPackIndex = 0;
List<DatabaseHelper.Level> levels = database.GetLevels(levelPackIndex);
int unlockedCount = UnlockedCount(levelPackIndex, levels.Count);
foreach (DatabaseHelper.Level level in levels)
{
GameObject newButton = Instantiate(button) as GameObject;
LevelButton levelButton = newButton.GetComponent<LevelButton>();
int levelIndex = levels.IndexOf(level);
bool isInteractable = levelIndex < unlockedCount;
levelButton.LevelText.text = (levelIndex + 1).ToString();
levelButton.levelPack = levelPackIndex;
levelButton.level = levelIndex;
levelButton.hasBoss = level.hasBoss;
levelButton.hasHelicopter = level.hasHelicopter;
levelButton.GetComponent<UnityEngine.UI.Button>().interactable = isInteractable;
if (isInteractable)
levelButton.GetComponent<UnityEngine.UI.Button>().onClick.AddListener(soundDirector.ButtonClick);
newButton.transform.SetParent(Spacer);
}
}