using UnityEngine;
using UnityEngine.SceneManagement;
///
/// ListCourseScreen scene manager
///
public class CourseListManager : MonoBehaviour
{
///
/// Reference to the course-list container object
///
public Transform courseContainer;
///
/// Prefab of the course item object
///
public GameObject courseItemPrefab;
///
/// Reference to the list of all courses
///
public CourseList courseList;
///
/// Start is called before the first frame update
///
void Start()
{
foreach (Course course in courseList.courses)
{
// Create instance of prefab
GameObject instance = GameObject.Instantiate(courseItemPrefab, courseContainer);
// Dynamically load appearance
CourseItem item = instance.GetComponent();
item.course = course;
}
}
///
/// Method used as callback for course item onClick events
///
/// The path to the new scene (path == $"Assets/{sceneName}")
public void LoadScene(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
}