GameVsJam/3d Prototyp/Assets/DeveloperInfoUi.cs

49 lines
1.3 KiB
C#
Raw Normal View History

2024-04-07 20:01:41 +02:00
using System;
using System.Collections;
using System.Collections.Generic;
2024-04-08 19:08:37 +02:00
using TMPro;
2024-04-07 20:01:41 +02:00
using UnityEngine;
using UnityEngine.UI;
public class DeveloperInfoUi : MonoBehaviour
{
[SerializeField]
private Developer _developer;
[SerializeField]
private RawImage _developerPortrait;
[SerializeField]
private Image _hungerImage;
[SerializeField]
private Image _caffeineImage;
[SerializeField]
private Image _toiletImage;
[SerializeField]
private Image _happinessImage;
[SerializeField]
private Gradient _statusGradient;
2024-04-08 19:08:37 +02:00
[SerializeField] private TextMeshProUGUI _fingerText;
2024-04-07 20:01:41 +02:00
void Start()
{
_developerPortrait.texture = _developer.GetComponentInChildren<Camera>().targetTexture;
}
// Update is called once per frame
void Update()
{
2024-04-08 20:33:29 +02:00
_happinessImage.color = _statusGradient.Evaluate((float)_developer.CurrentHappiness);
2024-04-07 20:01:41 +02:00
_caffeineImage.color = _statusGradient.Evaluate((float)_developer.CurrentCaffeination);
_hungerImage.color = _statusGradient.Evaluate((float)_developer.CurrentHunger);
_toiletImage.color = _statusGradient.Evaluate((float)_developer.CurrentUrgeToUrinate);
2024-04-08 19:08:37 +02:00
_fingerText.text = _developer.FingersLeft.ToString();
2024-04-07 20:01:41 +02:00
}
}