sega 826ff5782a Доработать игровые режимы, призы и настройки
Добавить таймеры и шкалы прогресса, расширить призовую систему и контроль остатков, восстановить настройки и обновить таблицу призов главного меню.
2026-09-14 10:47:25 +03:00

59 lines
1.3 KiB
C#

using PrizeSystem;
using System.Collections.Generic;
using UnityEngine;
namespace CharacterSystem
{
public class PrizeModule : MonoBehaviour
{
private List<Prize> _prizes;
public bool HasPrize { get; private set; }
public bool HasConfiguredPrize
=> _prizes != null && _prizes.Exists(prize => prize is not EmptyPrize);
public void SetPrizes(PrizeSet prizesSet)
{
_prizes = prizesSet.Prizes;
}
public void ResetModule()
{
HasPrize = true;
}
public List<Prize> CheckPrizes()
=> _prizes;
public bool TryFetchPrize(out List<Prize> prizes)
{
if (HasPrize)
{
prizes = _prizes;
HasPrize = false;
return true;
}
prizes = null;
return false;
}
public bool TryFetchIfTypeMatch<T>(out T castedPrize) where T : Prize
{
castedPrize = null;
if (HasPrize == false)
return false;
if (_prizes is T casted)
{
castedPrize = casted;
HasPrize = false;
return true;
}
return false;
}
}
}