44 lines
989 B
C#
44 lines
989 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class UiController : MonoBehaviour
|
|
{
|
|
[Header("Objects")]
|
|
[SerializeField]
|
|
private Pickupper _pickupper;
|
|
|
|
[Header("UI Elements")]
|
|
[SerializeField]
|
|
private GameObject _actionDisplay;
|
|
[SerializeField]
|
|
private TextMeshProUGUI _actionText;
|
|
[SerializeField]
|
|
private Button _prevActionButton;
|
|
[SerializeField]
|
|
private Button _nextActionButton;
|
|
|
|
void Update()
|
|
{
|
|
UpdateActionDisplay();
|
|
}
|
|
|
|
private void UpdateActionDisplay()
|
|
{
|
|
bool show = _pickupper.PickupablesInRange.Count > 0;
|
|
|
|
_actionDisplay.SetActive(show);
|
|
|
|
if (!show)
|
|
return;
|
|
|
|
_actionText.text = $"{_pickupper.Selected.Name}";
|
|
|
|
_prevActionButton.interactable = _pickupper.CanSelectPrevious;
|
|
_nextActionButton.interactable = _pickupper.CanSelectNext;
|
|
}
|
|
}
|