Sprint 4
This commit is contained in:
49
Assets/Courses/Scripts/PanelWithImage.cs
Normal file
49
Assets/Courses/Scripts/PanelWithImage.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PanelWithImage : MonoBehaviour
|
||||
{
|
||||
public GameObject feedbackProgressObject;
|
||||
public GameObject previewMessage;
|
||||
public bool isPreview;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the image for displaying the current words sprite
|
||||
/// </summary>
|
||||
public Transform signImageContainer;
|
||||
|
||||
public GameObject signImagePrefab;
|
||||
|
||||
public RawImage webcamScreen;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the feedback field
|
||||
/// </summary>
|
||||
public TMP_Text feedbackText;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the progress bar
|
||||
/// </summary>
|
||||
public Slider feedbackProgressBar;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the progress bar image, so we can add fancy colors
|
||||
/// </summary>
|
||||
public Image feedbackProgressImage;
|
||||
|
||||
public List<Learnable> signs;
|
||||
public int currentSignIndex;
|
||||
|
||||
public void Display()
|
||||
{
|
||||
Learnable currentSign = signs[currentSignIndex];
|
||||
|
||||
feedbackProgressObject.SetActive(!isPreview);
|
||||
previewMessage.SetActive(isPreview);
|
||||
|
||||
GameObject sprite = GameObject.Instantiate(signImagePrefab, signImageContainer);
|
||||
sprite.GetComponent<Image>().sprite = currentSign.image;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user