File size: 1,855 Bytes
7b5e094 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
using System;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
[Serializable]
public class GUIController : MonoBehaviour
{
[SerializeField]
private Text _iterationText;
[SerializeField]
private Text _stepText;
[SerializeField]
private Text _learningRateText;
[SerializeField]
private Text _discountingFactorText;
[SerializeField]
private Text _stepTimeText;
public Text IterationText { get => _iterationText; set => _iterationText = value; }
public Text StepText { get => _stepText; set => _stepText = value; }
public Text LearningRateText { get => _learningRateText; set => _learningRateText = value; }
public Text DiscountingFactorText { get => _discountingFactorText; set => _discountingFactorText = value; }
public Text StepTimeText { get => _stepTimeText; set => _stepTimeText = value; }
public GameObject weightDisplayPanel;
public void UpdateInterationText(string newText)
{
IterationText.text = $"Iteration: {newText}";
}
public void UpdateStepText(string newText)
{
StepText.text = $"Step: {newText}";
}
public void UpdateLearningRateValue(float newValue)
{
LearningRateText.text = $"LearningRate: {newValue}";
}
public void UpdateDiscountingFactorValue(float newValue)
{
DiscountingFactorText.text = $"Discounting Factor: {newValue}";
}
public void UpdateStepTimeValue(float newValue)
{
StepTimeText.text = $"Step Time: {newValue}";
}
public void ResetScene()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
public void ShowWeightDisplay()
{
weightDisplayPanel.SetActive(true);
}
public void HideWeightDisplay()
{
weightDisplayPanel.SetActive(false);
}
}
|