Resolve WES-43 "Minigame framework"
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using JetBrains.Annotations;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
@@ -16,10 +15,15 @@ public class CourseItem : MonoBehaviour
|
||||
public string courseScene;
|
||||
|
||||
[Header("UI references")]
|
||||
// Reference to thumbnail object
|
||||
public Image thumbnail;
|
||||
// Reference to title object
|
||||
public TMP_Text title;
|
||||
// Refetence to object so correct callback can be trigger on click
|
||||
public Button button;
|
||||
// Reference to progress bar
|
||||
public GameObject slider;
|
||||
// Reference to `COMPLETED`
|
||||
public GameObject completed;
|
||||
|
||||
|
||||
@@ -29,11 +33,6 @@ public class CourseItem : MonoBehaviour
|
||||
GenerateContent();
|
||||
}
|
||||
|
||||
private void LoadCourseInfo()
|
||||
{
|
||||
SceneManager.LoadScene(courseScene);
|
||||
}
|
||||
|
||||
public void GenerateContent()
|
||||
{
|
||||
// Set appearance
|
||||
@@ -45,8 +44,8 @@ public class CourseItem : MonoBehaviour
|
||||
completed.SetActive(1.0f <= progress);
|
||||
slider.SetActive(0.0f < progress && progress < 1.0f);
|
||||
slider.GetComponent<Slider>().value = progress;
|
||||
|
||||
|
||||
// Add click functionality
|
||||
button.onClick.AddListener(LoadCourseInfo);
|
||||
button.onClick.AddListener(() => SceneManager.LoadScene(courseScene));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user