2022-12-07 12:13:57 +02:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
|
|
|
|
public class DemonNameplate : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
[SerializeField] private TextMeshProUGUI _readyText = default;
|
|
|
|
|
[SerializeField] private TextMeshProUGUI _demonNameText = default;
|
|
|
|
|
[SerializeField] private TextMeshProUGUI _assistText = default;
|
|
|
|
|
[SerializeField] private Image _characterImage = default;
|
|
|
|
|
[SerializeField] private PlayerStatsSO[] _playersStatsSo = default;
|
2022-12-08 14:35:27 +02:00
|
|
|
private bool _ready;
|
2022-12-07 12:13:57 +02:00
|
|
|
|
|
|
|
|
public void SetDemonData(DemonData demonData)
|
|
|
|
|
{
|
2022-12-08 14:35:27 +02:00
|
|
|
if (gameObject != null)
|
|
|
|
|
{
|
|
|
|
|
gameObject.SetActive(true);
|
|
|
|
|
_demonNameText.text = demonData.demonName;
|
2023-02-18 19:19:15 +02:00
|
|
|
if (demonData.assist == 0)
|
|
|
|
|
{
|
|
|
|
|
_assistText.text = $"Assist A";
|
|
|
|
|
}
|
|
|
|
|
else if (demonData.assist == 1)
|
|
|
|
|
{
|
|
|
|
|
_assistText.text = $"Assist B";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_assistText.text = $"Assist C";
|
|
|
|
|
}
|
2023-03-19 15:57:03 +02:00
|
|
|
_characterImage.sprite = _playersStatsSo[demonData.character].portraits[demonData.color];
|
2022-12-08 14:35:27 +02:00
|
|
|
}
|
2022-12-07 12:13:57 +02:00
|
|
|
}
|
|
|
|
|
|
2022-12-08 14:35:27 +02:00
|
|
|
public bool ToggleReady()
|
2022-12-07 12:13:57 +02:00
|
|
|
{
|
2022-12-08 14:35:27 +02:00
|
|
|
_ready = !_ready;
|
|
|
|
|
if (_ready)
|
|
|
|
|
{
|
|
|
|
|
_readyText.text = "Ready";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-12-08 17:39:21 +02:00
|
|
|
_readyText.text = "Waiting";
|
2022-12-08 14:35:27 +02:00
|
|
|
}
|
|
|
|
|
return _ready;
|
|
|
|
|
}
|
|
|
|
|
public void SetReady(bool ready)
|
|
|
|
|
{
|
|
|
|
|
_ready = ready;
|
|
|
|
|
if (_ready)
|
2022-12-07 12:13:57 +02:00
|
|
|
{
|
|
|
|
|
_readyText.text = "Ready";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-12-08 17:39:21 +02:00
|
|
|
_readyText.text = "Waiting";
|
2022-12-07 12:13:57 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|