using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
///
/// Handles the display of themes in the ThemeSelectionController scene
///
public class ThemeItem : MonoBehaviour
{
///
/// The theme title
///
public string themeTitle;
///
/// A short description of the theme
///
public string themeDescription;
///
/// The callback function to start the game with the correct theme loaded
///
public UnityAction startGameCallback;
///
/// UI reference to the gameobject for displaying the theme title
///
public TMP_Text title;
///
/// UI reference to the gameobject for displaying the description
///
public TMP_Text description;
///
/// UI reference to the button so the correct callback can be trigger on click
///
public Button button;
///
/// Start is called before the first frame update
///
void Start()
{
// Use public function so that this component can get Instantiated
GenerateContent();
}
///
/// (Re)generate the ThemeItem object and update its appearance
///
public void GenerateContent()
{
// Set appearance
title.text = themeTitle;
// TODO: make description only visible when hovering
description.text = themeDescription;
// Add click functionality
button.onClick.AddListener(startGameCallback);
}
}