42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using UnityEngine;
|
|
|
|
//показ таблицы лидеров после победы.
|
|
public class LeaderboardState : IState
|
|
{
|
|
PlayerStatsRecord record;
|
|
Leaderboard leaderboard;
|
|
public LeaderboardState(PlayerStatsRecord record)
|
|
{
|
|
this.record = record;
|
|
}
|
|
|
|
public void enter()
|
|
{
|
|
leaderboard = GameManager.Instance.leaderboard;
|
|
leaderboard.gameObject.SetActive(true);
|
|
leaderboard.Initialize();
|
|
|
|
PlayerStatsRecord lastRecord = GameManager.Instance.StatsService.GetLatestRecord();
|
|
leaderboard.DisplayCurrentPlayer(record);
|
|
}
|
|
|
|
public void exit()
|
|
{
|
|
leaderboard.ClearRowsText();
|
|
leaderboard.gameObject.SetActive(false);
|
|
}
|
|
|
|
public void update()
|
|
{
|
|
bool keepDownButton = In.GetButtonAnyPlayer(PlayerAction.down);
|
|
float accelerationSign = keepDownButton ? 1 : -1f;
|
|
leaderboard.accelerationY = Mathf.Abs(leaderboard.accelerationY) * accelerationSign;
|
|
|
|
if (In.GetButtonDownAnyPlayer(PlayerAction.left) && In.GetButtonDownAnyPlayer(PlayerAction.right))
|
|
{
|
|
Board.Instance.MakeClearField();
|
|
GameManager.Instance.GotoMenu();
|
|
}
|
|
}
|
|
}
|