/// <summary>
    /// Create and instantiate a level select button base on item
    /// </summary>
    /// <param name="item">The level data</param>
    /// <returns>The created button</returns>
    protected LevelSelectButton CreateButton(LevelItem item)
    {
        LevelSelectButton button = Instantiate(SelectionPrefab);

        button.Initialize(item);
        return(button);
    }
Ejemplo n.º 2
0
 void Start()
 {
     for (int i = 0; i <= PlaySessionManager.ins.FurthestLevel; i++)
     {
         LevelSelectButton newButton = Instantiate(buttonPrefab, buttonContainer);
         newButton.Initialize(this, i);
     }
 }
Ejemplo n.º 3
0
 private void InitializeLevelsList()
 {
     for (int i = 0; i < levels.levels.Length; i++)
     {
         level             l                 = levels.levels[i];
         GameObject        levelObject       = Instantiate(levelPrefab, levelContentGroup.transform);
         LevelSelectButton levelSelectButton = levelObject.GetComponent <LevelSelectButton>();
         levelSelectButton.level = l;
         levelSelectButton.Initialize();
     }
 }
Ejemplo n.º 4
0
    private void InitLevelSelectButtons()
    {
        LevelSelectButton[] existingButtons = GetComponentsInChildren <LevelSelectButton>();
        foreach (LevelSelectButton button in existingButtons)
        {
            Destroy(button.gameObject);
        }

        for (int i = 0; i < levelsCount; i++)
        {
            LevelSelectButton levelSelectButton =
                Instantiate(levelSelectButtonPrefab, transform);
            levelSelectButton.Initialize(this, i, unlockedLevels.Contains(i));
        }
    }