Забрать или продолжить панель. Выбор опции на кнопки и1 и2 без нажатия
This commit is contained in:
parent
3379e4127c
commit
ff77739c6a
@ -11349,7 +11349,7 @@ Material:
|
||||
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
|
||||
- _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _GlowColor: {r: 0, g: 1, b: 0.65522504, a: 1}
|
||||
- _GlowColor: {r: 1, g: 0.26309127, b: 0, a: 1}
|
||||
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
|
||||
- _OutlineColor: {r: 0.554717, g: 0.554717, b: 0.554717, a: 1}
|
||||
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -16,11 +16,6 @@ namespace PrizeSystem
|
||||
[SerializeField] private Color DisabledColor;
|
||||
[SerializeField] float HsvSpeed = 0.3f;
|
||||
|
||||
[Header("Настройка таймера")]
|
||||
[SerializeField] private Image TimerRing;
|
||||
[SerializeField] private AnimationCurve TimerFillCurve;
|
||||
[SerializeField] private float TimeToAccept = 2;
|
||||
|
||||
[Header("Анимация размера панелей")]
|
||||
[SerializeField] private float ScalingSpeed = 1;
|
||||
[SerializeField] private float SelectedScale = 1.05f;
|
||||
@ -52,8 +47,19 @@ namespace PrizeSystem
|
||||
|
||||
void Update()
|
||||
{
|
||||
var inputs = ProcessInput();
|
||||
UpdateState(inputs.selectedOption, inputs.timerDelta);
|
||||
//var inputs = ProcessInput();
|
||||
//UpdateState(inputs.selectedOption, inputs.timerDelta);
|
||||
|
||||
if(In.GetButtonDown(ButtonPinMapping.startOnePlayer))
|
||||
{
|
||||
SelectedOption = TakeOrRiskOption.Take;
|
||||
Accept();
|
||||
}
|
||||
if (In.GetButtonDown(ButtonPinMapping.startTwoPlayers))
|
||||
{
|
||||
SelectedOption = TakeOrRiskOption.Risk;
|
||||
Accept();
|
||||
}
|
||||
DisplayGraphics();
|
||||
}
|
||||
|
||||
@ -69,48 +75,49 @@ namespace PrizeSystem
|
||||
NextPrizeView.Clear();
|
||||
}
|
||||
|
||||
private (TakeOrRiskOption selectedOption, float timerDelta) ProcessInput()
|
||||
{
|
||||
if (In.GetButtonAnyPlayer(PlayerAction.left) && SelectedOption != TakeOrRiskOption.Take)
|
||||
{
|
||||
SoundManager.instance.playSwitch();
|
||||
SelectedOption = TakeOrRiskOption.Take;
|
||||
}
|
||||
if (In.GetButtonAnyPlayer(PlayerAction.right) && SelectedOption != TakeOrRiskOption.Risk)
|
||||
{
|
||||
SoundManager.instance.playSwitch();
|
||||
SelectedOption = TakeOrRiskOption.Risk;
|
||||
}
|
||||
//private (TakeOrRiskOption selectedOption, float timerDelta) ProcessInput()
|
||||
//{
|
||||
// //if (In.GetButtonAnyPlayer(PlayerAction.left) && SelectedOption != TakeOrRiskOption.Take)
|
||||
// //{
|
||||
// // //SoundManager.instance.playSwitch();
|
||||
// // //SelectedOption = TakeOrRiskOption.Take;
|
||||
// //}
|
||||
// //if (In.GetButtonAnyPlayer(PlayerAction.right) && SelectedOption != TakeOrRiskOption.Risk)
|
||||
// //{
|
||||
// // //SoundManager.instance.playSwitch();
|
||||
// // //SelectedOption = TakeOrRiskOption.Risk;
|
||||
// //}
|
||||
|
||||
if(In.GetButtonDownAnyPlayer(PlayerAction.down)) SoundManager.instance.playClip(StartAcceptingClip);
|
||||
float timerDelta = Time.deltaTime * (In.GetButtonAnyPlayer(PlayerAction.down) ? 1 : -1);
|
||||
// //if(In.GetButtonDownAnyPlayer(PlayerAction.down)) SoundManager.instance.playClip(StartAcceptingClip);
|
||||
// //float timerDelta = Time.deltaTime * (In.GetButtonAnyPlayer(PlayerAction.down) ? 1 : -1);
|
||||
|
||||
return (SelectedOption, timerDelta);
|
||||
}
|
||||
// //return (SelectedOption, timerDelta);
|
||||
//}
|
||||
|
||||
private void UpdateState(TakeOrRiskOption selectedOption, float timerDelta)
|
||||
{
|
||||
activeFrame = selectedOption == TakeOrRiskOption.Take ? CurrentPrizeFrame : NextPrizeFrame;
|
||||
inactiveFrame = selectedOption == TakeOrRiskOption.Take ? NextPrizeFrame : CurrentPrizeFrame;
|
||||
//private void UpdateState(TakeOrRiskOption selectedOption, float timerDelta)
|
||||
//{
|
||||
// activeFrame = selectedOption == TakeOrRiskOption.Take ? CurrentPrizeFrame : NextPrizeFrame;
|
||||
// inactiveFrame = selectedOption == TakeOrRiskOption.Take ? NextPrizeFrame : CurrentPrizeFrame;
|
||||
|
||||
acceptTimer = Mathf.Clamp(acceptTimer + timerDelta, 0, TimeToAccept);
|
||||
if (acceptTimer >= TimeToAccept) Accept();
|
||||
}
|
||||
// acceptTimer = Mathf.Clamp(acceptTimer + timerDelta, 0, TimeToAccept);
|
||||
// if (acceptTimer >= TimeToAccept) Accept();
|
||||
//}
|
||||
|
||||
private void DisplayGraphics()
|
||||
{
|
||||
// Скалирование
|
||||
activeFrame.transform.localScale = Vector3.MoveTowards(activeFrame.transform.localScale, Vector3.one * SelectedScale, Time.deltaTime * ScalingSpeed);
|
||||
inactiveFrame.transform.localScale = Vector3.MoveTowards(inactiveFrame.transform.localScale, Vector3.one * IdleScale, Time.deltaTime * ScalingSpeed);
|
||||
//activeFrame.transform.localScale = Vector3.MoveTowards(activeFrame.transform.localScale, Vector3.one * SelectedScale, Time.deltaTime * ScalingSpeed);
|
||||
//inactiveFrame.transform.localScale = Vector3.MoveTowards(inactiveFrame.transform.localScale, Vector3.one * IdleScale, Time.deltaTime * ScalingSpeed);
|
||||
|
||||
//Цвет рамки
|
||||
float hue = (Time.time * HsvSpeed) % 1f;
|
||||
activeFrame.color = Color.HSVToRGB(hue, 1, 1);
|
||||
inactiveFrame.color = DisabledColor;
|
||||
Color animatedColor = Color.HSVToRGB(hue, 1, 1);
|
||||
activeFrame.color = animatedColor;
|
||||
inactiveFrame.color = animatedColor;
|
||||
|
||||
//Круговой таймер
|
||||
float timerPercent = acceptTimer / TimeToAccept;
|
||||
TimerRing.fillAmount = TimerFillCurve.Evaluate(timerPercent);
|
||||
//float timerPercent = acceptTimer / TimeToAccept;
|
||||
//TimerRing.fillAmount = TimerFillCurve.Evaluate(timerPercent);
|
||||
}
|
||||
|
||||
private void Accept()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user