StartRoundState заменено методом
This commit is contained in:
parent
1aa5ecbb1e
commit
99ccb2e8ae
@ -1,52 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class StartTurnState : IState
|
||||
{
|
||||
GameObject chip;
|
||||
GameManager gm;
|
||||
public void enter()
|
||||
{
|
||||
gm = GameManager.instance;
|
||||
gm.spawnChip();
|
||||
chip = gm.currentChip;
|
||||
|
||||
if (gm.gameMode == GameMode.pvp)//переключаем таймеры только в pvp
|
||||
{
|
||||
gm.timerManager.SetActiveTimer(gm.currentPlayer);
|
||||
LightUtility.Player(gm.currentPlayer);
|
||||
}
|
||||
|
||||
if (chip != null)
|
||||
{
|
||||
//первый игрок ходит
|
||||
if (GameManager.instance.currentPlayer == CellState.Player1)
|
||||
{
|
||||
|
||||
GameManager.instance.stateMachine.ChangeState(new PositioningState());
|
||||
//GameManager.instance.stateMachine.ChangeState(new BotThinkingState(0));//бот сам с собой
|
||||
//GameManager.instance.stateMachine.ChangeState(new BotThinkingState(0, gm.MistressPreset));//фишка против ботов
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
IState nextState;
|
||||
switch (GameManager.instance.gameMode)
|
||||
{
|
||||
case GameMode.pve:
|
||||
nextState = new BotThinkingState(CharacterController.CurrentCharacter.ThinkTime); break;
|
||||
case GameMode.pvp:
|
||||
nextState = new PositioningState(); break;
|
||||
default:
|
||||
nextState = new PositioningState(); break;
|
||||
}
|
||||
GameManager.instance.stateMachine.ChangeState(nextState);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void exit()
|
||||
{
|
||||
}
|
||||
public void update()
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3ccb76027a8439408d731808709a4c4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -10,9 +10,14 @@ public static class StateRouter
|
||||
gm.lastResult = checkResult;//это неправильно. Нужно при проверке записывать в поле.
|
||||
TurnEndingResult turnResult = EndOfTurnHandler.Evaluate(checkResult, gm.gameMode, gm.currentPlayer);
|
||||
|
||||
if(turnResult == TurnEndingResult.GameContinues)
|
||||
{
|
||||
gm.DetermineNextTurn();
|
||||
return;
|
||||
}
|
||||
|
||||
IState nextState = turnResult switch
|
||||
{
|
||||
TurnEndingResult.GameContinues => GameContinuesHandler(),
|
||||
TurnEndingResult.BotWin => BotWinHandler(),
|
||||
TurnEndingResult.PlayerWinPve => PlayerWinPveHandler(),
|
||||
TurnEndingResult.PlayerWinPvp => PlayerWinPvpHandler(gm.currentPlayer),
|
||||
@ -23,11 +28,6 @@ public static class StateRouter
|
||||
gm.stateMachine.ChangeState(nextState);
|
||||
}
|
||||
|
||||
private static IState GameContinuesHandler()
|
||||
{
|
||||
gm.SwitchPlayer();
|
||||
return new StartTurnState();
|
||||
}
|
||||
|
||||
private static IState BotWinHandler()
|
||||
{
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
using PrizeSystem;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
public enum GameMode { pve, pvp }
|
||||
public class GameManager : MonoBehaviour
|
||||
@ -16,7 +14,6 @@ public class GameManager : MonoBehaviour
|
||||
public PlayerStatsService StatsService;
|
||||
|
||||
public int botsAmount = 5;
|
||||
|
||||
public int boardVersion = 1;
|
||||
|
||||
[Header("General")]
|
||||
@ -67,7 +64,6 @@ public class GameManager : MonoBehaviour
|
||||
public TextMeshProUGUI TimerLabel; //до выхода в меню..
|
||||
public TextMeshProUGUI ToMenuLabel; //это же
|
||||
|
||||
|
||||
public WinPanel winPanel;
|
||||
|
||||
[HideInInspector] public CellState currentPlayer = CellState.Player2;
|
||||
@ -79,7 +75,6 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
public bool moveMade = false;
|
||||
|
||||
|
||||
public float chipXSpeed = 10,
|
||||
chipYSpeed = 0,
|
||||
chipAcceleration = 20;
|
||||
@ -243,12 +238,11 @@ public class GameManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void OnApplicationQuit()
|
||||
{
|
||||
ComNativeWrapper.Serial_CloseAll();
|
||||
}
|
||||
|
||||
private void PrizeStandController_InitializationComplete(bool arg1, string arg2)
|
||||
{
|
||||
logger.Log($"Инициализация витрины: {arg1} : {arg2}");
|
||||
@ -434,9 +428,37 @@ public class GameManager : MonoBehaviour
|
||||
DualAvatarController.Instance.ShowCharacters();
|
||||
|
||||
VitrinaView.Instance.ActivateIfNeed();
|
||||
stateMachine.ChangeState(new StartTurnState());
|
||||
DetermineNextTurn(switchPlayer: false);
|
||||
}
|
||||
|
||||
public void DetermineNextTurn(bool switchPlayer = true)
|
||||
{
|
||||
if (switchPlayer) SwitchPlayer();
|
||||
spawnChip();
|
||||
|
||||
if (gameMode == GameMode.pvp)//переключаем таймеры только в pvp
|
||||
{
|
||||
timerManager.SetActiveTimer(currentPlayer);
|
||||
LightUtility.Player(currentPlayer);
|
||||
}
|
||||
|
||||
if (currentPlayer == CellState.Player1)
|
||||
{
|
||||
stateMachine.ChangeState(new PositioningState());
|
||||
}
|
||||
else
|
||||
{
|
||||
IState nextState;
|
||||
if (gameMode == GameMode.pvp)
|
||||
nextState = new PositioningState();
|
||||
else
|
||||
nextState = new BotThinkingState(CharacterController.CurrentCharacter.ThinkTime);
|
||||
|
||||
stateMachine.ChangeState(nextState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void ResetGameSession()
|
||||
{
|
||||
vsBotThinkTime = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user