Files
unity-application/Assets/Common/Scripts/ThemeSelectionScreen.cs
Helena Van Breugel a19d89db03 Resolve WES-80 "Data"
2023-03-18 22:32:36 +00:00

45 lines
1.2 KiB
C#

using UnityEngine;
/// <summary>
/// ThemeSelectionScreen scene manager
/// </summary>
public class ThemeSelectionScreen : MonoBehaviour
{
/// <summary>
/// Theme prefab
/// </summary>
public GameObject themePrefab;
/// <summary>
/// Reference to container holding all theme-buttons
/// </summary>
public Transform themesContainer;
/// <summary>
/// Reference to the minigamelist
/// </summary>
public MinigameList minigameList;
/// <summary>
/// Start is called before the first frame update
/// </summary>
void Start()
{
Minigame minigame = minigameList.minigames[minigameList.currentMinigameIndex];
ThemeList themeList = minigame.themeList;
for (int i = 0; i < themeList.themes.Count; i++)
{
Theme theme = themeList.themes[i];
// First, you need to create a new button game object
GameObject instance = GameObject.Instantiate(themePrefab, themesContainer);
// Dynamically load appearance
ThemeItem item = instance.GetComponent<ThemeItem>();
item.theme = theme;
//item.startGameCallback = () => OnButtonClick(theme.name);
}
}
}