55 lines
1.3 KiB
C#
55 lines
1.3 KiB
C#
using Godot;
|
|
using System;
|
|
|
|
public partial class CenterDisplayController : Node
|
|
{
|
|
[ExportCategory(" ")]
|
|
[Export] private Node2D _background;
|
|
[Export] private Label _counterLabel;
|
|
[Export] private Label _togoLabel;
|
|
[Export] private Label _pbtsLabel;
|
|
[Export] private AnimationPlayer _pbstAnimationPlayer;
|
|
[Export] private AnimationPlayer _counterAnimationPlayer;
|
|
|
|
|
|
|
|
private GameManager.State state;
|
|
public override void _Ready()
|
|
{
|
|
state = GameManager.CurrentState;
|
|
|
|
OnStateChange();
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
if (GameManager.CurrentState != state)
|
|
{
|
|
state = GameManager.CurrentState;
|
|
OnStateChange();
|
|
}
|
|
}
|
|
|
|
private void OnStateChange()
|
|
{
|
|
if (state == GameManager.State.IDLE)
|
|
{
|
|
_pbstAnimationPlayer.Play("TextFade");
|
|
_counterAnimationPlayer.Play("CounterOutIdle");
|
|
}
|
|
else if (state == GameManager.State.PLAY)
|
|
{
|
|
_pbstAnimationPlayer.Play("TextOutIdle");
|
|
_counterAnimationPlayer.Play("CounterFadeIn");
|
|
}
|
|
else if (state == GameManager.State.LOSS)
|
|
{
|
|
|
|
}
|
|
else if (state == GameManager.State.WIN)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|