53 lines
1.2 KiB
C#

using Newtonsoft.Json.Linq;
using UnityEngine;
using UnityEngine.UI;
public class TakeOrRiskPanel : MonoBehaviour
{
[SerializeField] Image CurrentPrizeFrame;
[SerializeField] Image NextPrizeFrame;
[SerializeField] private Color DisabledColor;
[SerializeField] float HSV_speed = 2;
private Image activeFrame;
private Image inactiveFrame;
private int index = 0;
private void OnEnable()
{
activeFrame = CurrentPrizeFrame;
inactiveFrame = NextPrizeFrame;
index = 0;
}
void Update()
{
// добавить скалирование
//подсветку на кнопку принять
if (In.GetButtonAnyPlayer(PlayerAction.left)) index = 0;
if (In.GetButtonAnyPlayer(PlayerAction.right)) index = 1;
if (index == 0)
{
activeFrame = CurrentPrizeFrame;
inactiveFrame = NextPrizeFrame;
}
else
{
activeFrame = NextPrizeFrame;
inactiveFrame = CurrentPrizeFrame;
}
float hue = (Time.time * HSV_speed) % 1f;
activeFrame.color = Color.HSVToRGB(hue, 1, 1);
inactiveFrame.color = DisabledColor;
}
}