Упразднено состояние StartRoundState
Заменено методом
This commit is contained in:
parent
b60ca37793
commit
1aa5ecbb1e
@ -6680,7 +6680,6 @@ MonoBehaviour:
|
||||
SettingsPointer: {fileID: 334401357}
|
||||
timerManager: {fileID: 259182288}
|
||||
rulesController: {fileID: 454272343}
|
||||
menuOpened: 1
|
||||
gameMode: 0
|
||||
coinPanel: {fileID: 1407544274}
|
||||
board: {fileID: 1551328425}
|
||||
|
||||
@ -123,7 +123,8 @@
|
||||
if (ui.AnimationInProcess) return;
|
||||
|
||||
CharacterController.ResetState();
|
||||
TransitionTo(new StartRoundState(CellState.Player1));
|
||||
SoundManager.instance.playChoose();
|
||||
gm.PrepareRound(CellState.Player1);
|
||||
|
||||
if (gm.gameMode == GameMode.pve)
|
||||
gm.movesAndTimeCounter.SetVisibility(true);
|
||||
|
||||
@ -8,13 +8,13 @@ public class ShowWinnerState : IState
|
||||
Color empty = new Color(0, 0, 0, 0);
|
||||
|
||||
CoinCounter coinCounter;
|
||||
private GameManager gameManager;
|
||||
private GameManager gm;
|
||||
GameManager GameManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if (gameManager == null) gameManager = GameManager.instance;
|
||||
return gameManager;
|
||||
if (gm == null) gm = GameManager.instance;
|
||||
return gm;
|
||||
}
|
||||
}
|
||||
public enum ShowWinnerSubstates { PanelFalling, HandlingInputs, PanelRising, ExitByTime }
|
||||
@ -190,13 +190,13 @@ public class ShowWinnerState : IState
|
||||
//bool bossUpgraded = GameManager.instance.BossUpgraded;
|
||||
bool bossFirst = SettingsManager.GetString("BaseBotDifficulty", "Фиксированная") != "Обычная";
|
||||
CellState firstRoundPlayer = bossFirst ? CellState.Player2 : CellState.Player1;
|
||||
GameManager.instance.stateMachine.ChangeState(new StartRoundState(firstPlayer: firstRoundPlayer));
|
||||
gm.PrepareRound(firstRoundPlayer);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
CellState nextPlayer = GameManager.instance.currentPlayer == CellState.Player1 ? CellState.Player2 : CellState.Player2;
|
||||
GameManager.instance.stateMachine.ChangeState(new StartRoundState(firstPlayer: nextPlayer));
|
||||
gm.PrepareRound(nextPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -254,7 +254,7 @@ public class ShowWinnerState : IState
|
||||
FieldCleaner.Clear();
|
||||
|
||||
CellState nextPlayer = GameManager.currentPlayer == CellState.Player1 ? CellState.Player2 : CellState.Player1;
|
||||
GameManager.stateMachine.ChangeState(new StartRoundState(nextPlayer));
|
||||
gm.PrepareRound(nextPlayer);
|
||||
break;
|
||||
case EndOption.Menu://чистим поле и переходим в меню с параметром чтобы панельки съехались обратно
|
||||
CharacterController.HideCharacter();
|
||||
@ -323,7 +323,7 @@ public class ShowWinnerState : IState
|
||||
|
||||
void paymentAndRestart()
|
||||
{
|
||||
int creditsPrice = gameManager.gameMode == GameMode.pve ? PaymentSystem.PriceRevenge : PaymentSystem.PricePvp;
|
||||
int creditsPrice = gm.gameMode == GameMode.pve ? PaymentSystem.PriceRevenge : PaymentSystem.PricePvp;
|
||||
|
||||
if (PaymentSystem.TryPay(creditsPrice))
|
||||
{
|
||||
@ -359,7 +359,7 @@ public class ShowWinnerState : IState
|
||||
|
||||
|
||||
//revengeprice
|
||||
if (gameManager.gameMode == GameMode.pve)
|
||||
if (gm.gameMode == GameMode.pve)
|
||||
coinCounter?.SetRevengePriceVisibility(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
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();
|
||||
}
|
||||
|
||||
VitrinaView.Instance.ActivateIfNeed();
|
||||
|
||||
gm.stateMachine.ChangeState(new StartTurnState());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
UnityEngine.Debug.LogError(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void exit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cc06d87e99a1f74780310aeca5774e3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,10 +1,11 @@
|
||||
using TMPro;
|
||||
using PrizeSystem;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections;
|
||||
using PrizeSystem;
|
||||
using System.Text;
|
||||
public enum GameMode { pve, pvp }
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
@ -13,7 +14,7 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
public int Rows = 7, Cols = 7;
|
||||
public PlayerStatsService StatsService;
|
||||
|
||||
|
||||
public int botsAmount = 5;
|
||||
|
||||
public int boardVersion = 1;
|
||||
@ -138,7 +139,7 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
ConfigManager.Initialize();
|
||||
UnityMainThreadDispatcher.Initialize();
|
||||
|
||||
|
||||
InitializePrefs();
|
||||
|
||||
SettingsManager.Initialize();
|
||||
@ -149,7 +150,7 @@ public class GameManager : MonoBehaviour
|
||||
logger = GetComponent<Logger>();
|
||||
|
||||
InitializeDevices();
|
||||
|
||||
|
||||
|
||||
|
||||
PaymentSystem.Initialize();
|
||||
@ -187,9 +188,9 @@ public class GameManager : MonoBehaviour
|
||||
var sb = new StringBuilder();
|
||||
//ИНИЦИАЛИЗАЦИЯ УСТРОЙСТВ
|
||||
var devices = ComPortScanner.ScanPorts();
|
||||
|
||||
|
||||
sb.AppendLine($"Найдено устройств: {devices.Count}");
|
||||
foreach ( var device in devices )
|
||||
foreach (var device in devices)
|
||||
{
|
||||
sb.Append($"{device.Key} : {device.Value}");
|
||||
}
|
||||
@ -418,6 +419,24 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void PrepareRound(CellState firstPlayer)
|
||||
{
|
||||
currentPlayer = firstPlayer;
|
||||
|
||||
timerManager.SetupTimers(gameMode);
|
||||
if (gameMode == GameMode.pve)
|
||||
{
|
||||
timerManager.SetActiveTimer(CellState.Player1);
|
||||
int difficultyIndex = DifficultyManager.Instance.currentOpponent;
|
||||
CharacterController.SwitchToCharacter(difficultyIndex);
|
||||
}
|
||||
else if (gameMode == GameMode.pvp)
|
||||
DualAvatarController.Instance.ShowCharacters();
|
||||
|
||||
VitrinaView.Instance.ActivateIfNeed();
|
||||
stateMachine.ChangeState(new StartTurnState());
|
||||
}
|
||||
|
||||
public void ResetGameSession()
|
||||
{
|
||||
vsBotThinkTime = 0;
|
||||
@ -456,5 +475,5 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user