chip-game/Assets/Scripts/GameFSM/StartRoundState.cs
2026-01-12 09:36:17 +03:00

68 lines
1.7 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;
using System.Diagnostics;
//Состояние, которое начинает раунд и подготавливает менеджера
public class StartRoundState : IState
{
CellState firstPlayer;//игрок, который будет ходить первый в этом раунде
GameManager gm;
public StartRoundState(CellState firstPlayer)
{
this.firstPlayer = firstPlayer;
}
public void enter()
{
try
{
//DebugWindow.Message("Старт раунда");
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());
//try
//{
//}
//catch(Exception e)
//{
// DebugWindow.Message(e.ToString());
//}
}
catch (Exception e)
{
UnityEngine.Debug.LogError(e.ToString());
}
}
public void exit()
{
}
public void update()
{
}
}