chip-game/Assets/Scripts/GameFSM/StartRoundState.cs
se_ga 16b02e828a Ссылки на группы главного меню развязаны в UiManager;
DifficultyManager изменен способ инициализации синглтона
2026-03-20 13:32:26 +03:00

53 lines
1.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
//Состояние, которое начинает раунд и подготавливает менеджера
public class StartRoundState : IState
{
CellState firstPlayer;//игрок, который будет ходить первый в этом раунде
GameManager gm;
public StartRoundState(CellState firstPlayer)
{
this.firstPlayer = firstPlayer;
}
public void enter()
{
try
{
gm = GameManager.instance;
gm.currentPlayer = firstPlayer;
gm.timerManager.SetupTimers(gm.gameMode);
if (gm.gameMode == GameMode.pve)
gm.timerManager.SetActiveTimer(CellState.Player1);//если деремся с ботом, держим таймер включенным
int difficultyIndex = DifficultyManager.Instance.currentOpponent;
if (gm.gameMode == GameMode.pve)
{
CharacterController.SwitchToCharacter(difficultyIndex);
}
if (gm.gameMode == GameMode.pvp)
{
DualAvatarController.Instance.ShowCharacters();
}
gm.stateMachine.ChangeState(new StartTurnState());
}
catch (Exception e)
{
UnityEngine.Debug.LogError(e.ToString());
}
}
public void exit()
{
}
public void update()
{
}
}