chip-gameV3/Assets/Scripts/Gameplay/GameplayLevelBar.cs

35 lines
1.2 KiB
C#

using CharacterSystem;
using TMPro;
using UnityEngine;
public sealed class GameplayLevelBar : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI _title;
[SerializeField] private Timer _timer;
[SerializeField] private LevelBarCell[] _cells;
public Timer Timer => _timer;
public void ConfigurePve(int currentCharacterIndex, CharactersController charactersController)
{
_title.text = "ВРЕМЯ ДО ПРОИГРЫША";
for (int index = 0; index < _cells.Length; index++)
{
bool hasCharacter = index < CharactersController.CharactersAmount;
bool filled = hasCharacter && index < currentCharacterIndex;
bool framed = hasCharacter && index == currentCharacterIndex;
bool hasGift = hasCharacter && charactersController.HasConfiguredPrize(index);
_cells[index].Configure(filled, framed, hasGift);
}
}
public void ConfigurePvp(int playerNumber, int score)
{
_title.text = $"ИГРОК {playerNumber}";
for (int index = 0; index < _cells.Length; index++)
_cells[index].Configure(index < score, false, false);
}
}