Рефакторинг; Выпилил DifficultyManager(legacy)
This commit is contained in:
parent
116b9b3116
commit
20120be96f
@ -3286,6 +3286,7 @@ MonoBehaviour:
|
||||
difficultyPreset: {fileID: 11400000, guid: 1c381d73d66d6254d8e6326516732d27, type: 2}
|
||||
useDummyBots: 0
|
||||
minThinkingTime: 2
|
||||
dummyPreset: {fileID: 0}
|
||||
--- !u!4 &167531122
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -4738,10 +4739,6 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 05be8fefee27c564fbb37e319abd33b1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
OnVictory:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
currentOpponent: 0
|
||||
DummyPreset: {fileID: 11400000, guid: 35ba7f84d7557e8479f7f086269256f6, type: 2}
|
||||
dummyBots: 0
|
||||
--- !u!114 &259182288
|
||||
@ -25894,9 +25891,6 @@ MonoBehaviour:
|
||||
- {fileID: 8873348988979391587, guid: 280922cd1d9e3ef44bdbfe757f8cfdef, type: 3}
|
||||
- {fileID: 8873348988979391587, guid: b1bd71cccf32b4c4a94b2ff65361e9fe, type: 3}
|
||||
- {fileID: 8873348988979391587, guid: 4b7845a03cf955e4488f4e3286f11b60, type: 3}
|
||||
shownX: 0
|
||||
hiddenX: 2000
|
||||
speed: 2000
|
||||
--- !u!4 &1542626845
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -57,7 +57,6 @@ public class Bootstrap : MonoBehaviour
|
||||
#if !UNITY_EDITOR
|
||||
CheckLicense();
|
||||
#endif
|
||||
DifficultyManager.Instance.dummyBots = false;
|
||||
|
||||
//todo: сагрегировать эти объекты
|
||||
avatarController.GetComponent<AvatarEventBus>().Initialize();
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4bcfcfaa428d03245abb344c26184c58
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -10,33 +10,17 @@ namespace CharacterSystem
|
||||
public static CharactersController I;
|
||||
|
||||
[SerializeField] private List<Character> characterPrefabs;
|
||||
[SerializeField] float shownX = 0, hiddenX = 2000;
|
||||
|
||||
[SerializeField] private float speed;
|
||||
|
||||
private Character[] characters;
|
||||
private int currentIndex = 0;
|
||||
|
||||
public static int CharacterIndex { get; private set; } = -1;
|
||||
public static int CharactersAmount => I.characters.Length;
|
||||
public static Character CurrentCharacter => I.characters[I.currentIndex];
|
||||
public static Character CurrentCharacter => I.characters[CharacterIndex];
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
I = this;
|
||||
SetupCharacters();
|
||||
GameManager.OnGameStarted += Enable;
|
||||
GameManager.OnGameFinished += Disable;
|
||||
}
|
||||
|
||||
public void Enable(GameMode gameMode)
|
||||
{
|
||||
if (gameMode == GameMode.pve)
|
||||
print("ВКЛЮЧЕНИЕ СИСТЕМЫ ПЕРСОНАЖЕЙ");
|
||||
}
|
||||
public void Disable(GameMode gameMode)
|
||||
{
|
||||
if (gameMode == GameMode.pve)
|
||||
print("ВЫКЛЮЧЕНИЕ СИСТЕМЫ ПЕРСОНАЖЕЙ");
|
||||
}
|
||||
|
||||
public void SetAllCharactersPrizeAvailable()
|
||||
@ -51,23 +35,17 @@ namespace CharacterSystem
|
||||
character.difficultyModule.ResetPresetIndex();
|
||||
}
|
||||
|
||||
public void HideCharacter()
|
||||
public static void ResetSystem()
|
||||
{
|
||||
//CurrentCharacter?.UnbindEvents();
|
||||
ResetAllCharactersDifficulty();
|
||||
CharacterIndex = -1;
|
||||
}
|
||||
|
||||
public static void SwitchToCharacter(int index)
|
||||
{
|
||||
I.ShowCharacter(index);
|
||||
}
|
||||
public void HideCharacter()
|
||||
=> CurrentCharacter.visualModule.GetHideSequence().PlayForward();
|
||||
|
||||
public static void ResetState()
|
||||
{
|
||||
I.StopAllCoroutines();
|
||||
I.currentIndex = -1;
|
||||
}
|
||||
|
||||
public static Character[] GetCharactersArray() => new List<Character>(I.characters).ToArray();
|
||||
public static Character[] GetCharactersArray()
|
||||
=> new List<Character>(I.characters).ToArray();
|
||||
|
||||
private void SetupCharacters()
|
||||
{
|
||||
@ -79,7 +57,7 @@ namespace CharacterSystem
|
||||
|
||||
for (int i = 0; i < amount; i++)
|
||||
{
|
||||
var character = Instantiate(characterPrefabs[i]/*, charactersPool*/);
|
||||
var character = Instantiate(characterPrefabs[i]);
|
||||
characters[i] = character;
|
||||
character.Initialize(i);
|
||||
}
|
||||
@ -95,10 +73,10 @@ namespace CharacterSystem
|
||||
characters[i].prizeModule.SetPrize(prizes[i]);
|
||||
}
|
||||
|
||||
private void ShowCharacter(int newIndex)
|
||||
public void ShowCharacter(int newIndex)
|
||||
{
|
||||
int oldIndex = currentIndex;
|
||||
currentIndex = newIndex;
|
||||
int oldIndex = CharacterIndex;
|
||||
CharacterIndex = newIndex;
|
||||
|
||||
if (newIndex == oldIndex)
|
||||
return;
|
||||
@ -108,21 +86,16 @@ namespace CharacterSystem
|
||||
|
||||
Sequence seq = DOTween.Sequence();
|
||||
|
||||
|
||||
|
||||
seq.Append(oldCharacter.visualModule.GetHideSequence());
|
||||
|
||||
seq.AppendInterval(0.1f);
|
||||
|
||||
//вывод нового персонажа
|
||||
seq.Append(newCharacter.visualModule.GetShowSequence());
|
||||
|
||||
seq.AppendCallback(() =>
|
||||
{
|
||||
if (newIndex < oldIndex)
|
||||
CharacterEventBus.TriggerEvent(GameEvent.Return);
|
||||
EventBus.TriggerEvent(GameEvent.Return);
|
||||
else
|
||||
CharacterEventBus.TriggerEvent(GameEvent.Appear);
|
||||
EventBus.TriggerEvent(GameEvent.Appear);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,10 +32,10 @@ namespace CharacterSystem
|
||||
public DifficultyPreset GetCurrentPreset()
|
||||
=> _activeDifficultyList[presetIndex];
|
||||
|
||||
public void IncreaseDifficuly()
|
||||
public void IncreaseDifficulty()
|
||||
=> presetIndex = Mathf.Clamp(presetIndex + 1, 0, _activeDifficultyList.Count - 1);
|
||||
|
||||
public void DecreaseDifficuly()
|
||||
public void DecreaseDifficulty()
|
||||
=> presetIndex = Mathf.Clamp(presetIndex - 1, 0, _activeDifficultyList.Count - 1);
|
||||
|
||||
public void ResetPresetIndex()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace CharacterSystem
|
||||
{
|
||||
public static class CharacterEventBus
|
||||
public static class EventBus
|
||||
{
|
||||
public static event Action<GameEvent> OnGameEvent;
|
||||
public static void TriggerEvent(GameEvent gameEvent)
|
||||
2
Assets/Scripts/CharactersSystem/EventBus.cs.meta
Normal file
2
Assets/Scripts/CharactersSystem/EventBus.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e73ce235277322446a045e29357d0cbf
|
||||
@ -51,7 +51,7 @@ namespace CharacterSystem
|
||||
{
|
||||
_animator.enabled = true;
|
||||
_animator.SetTrigger("PreAppear");
|
||||
CharacterEventBus.OnGameEvent += OnGameEvent;
|
||||
EventBus.OnGameEvent += OnGameEvent;
|
||||
|
||||
Sequence seq = DOTween.Sequence();
|
||||
seq.Append(transform.DOMove(VisiblePos, showDuration).SetEase(showEase));
|
||||
@ -61,7 +61,7 @@ namespace CharacterSystem
|
||||
|
||||
public Sequence GetHideSequence()
|
||||
{
|
||||
CharacterEventBus.OnGameEvent -= OnGameEvent;
|
||||
EventBus.OnGameEvent -= OnGameEvent;
|
||||
|
||||
Sequence seq = DOTween.Sequence();
|
||||
seq.Append(transform.DOMove(HiddenPos, hideDuration).SetEase(hideEase));
|
||||
@ -85,14 +85,13 @@ namespace CharacterSystem
|
||||
_animator.SetTrigger("Lose");
|
||||
}
|
||||
|
||||
bool Message(GameEvent replicaType, bool force, bool showName = false)
|
||||
private void Message(GameEvent replicaType, bool force, bool showName = false)
|
||||
{
|
||||
if (replicas.WillPlay(replicaType) == false)
|
||||
return false;
|
||||
return;
|
||||
|
||||
Replica replicaToPlay = replicas.GetNextReplica(replicaType);
|
||||
_messageBox.PlayReplica(replicaToPlay, force).Forget();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void InvokeThrowChip()
|
||||
|
||||
@ -10,7 +10,7 @@ public class CheckLeadersFromMenuState : IState
|
||||
public void enter()
|
||||
{
|
||||
ComWrapper.InputRecieved +=ResetTimer;
|
||||
lb = GameManager.instance.leaderboard;
|
||||
lb = GameManager.Instance.leaderboard;
|
||||
|
||||
//вкл
|
||||
lb.gameObject.SetActive(true);
|
||||
@ -35,7 +35,7 @@ public class CheckLeadersFromMenuState : IState
|
||||
bool exitCombo = In.GetButtonDownAnyPlayer(PlayerAction.left) && In.GetButtonDownAnyPlayer(PlayerAction.right);
|
||||
if (exitCombo)
|
||||
{
|
||||
GameManager.instance.GotoMenu();
|
||||
GameManager.Instance.GotoMenu();
|
||||
}
|
||||
|
||||
bool keepDownButton = In.GetButtonAnyPlayer(PlayerAction.down);
|
||||
@ -45,7 +45,7 @@ public class CheckLeadersFromMenuState : IState
|
||||
timeElapsed += Time.deltaTime;
|
||||
if (timeElapsed > timeToExit)
|
||||
{
|
||||
GameManager.instance.GotoMenu();
|
||||
GameManager.Instance.GotoMenu();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ public class CheckSettingsPasswordState : IState
|
||||
Debug.Log("[Файла пароля нет. Сброс пароля. Заход в настройки]");
|
||||
disableCheck();
|
||||
|
||||
GameManager.instance.stateMachine.ChangeState(new SettingsState());
|
||||
GameManager.Instance.stateMachine.ChangeState(new SettingsState());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ public class CheckSettingsPasswordState : IState
|
||||
Debug.Log("[пароль невалидный. Сброс пароля. Заход в настройки]");
|
||||
disableCheck();
|
||||
ExternalFilesGetter.SetPassword("");
|
||||
GameManager.instance.stateMachine.ChangeState(new SettingsState());
|
||||
GameManager.Instance.stateMachine.ChangeState(new SettingsState());
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ public class CheckSettingsPasswordState : IState
|
||||
//{
|
||||
// GameManager.instance.stateMachine.ChangeState(new SettingsState());
|
||||
//}
|
||||
GameManager.instance.stateMachine.ChangeState(new SettingsState());
|
||||
GameManager.Instance.stateMachine.ChangeState(new SettingsState());
|
||||
}
|
||||
|
||||
private bool PasswordValid(string password)
|
||||
|
||||
@ -9,7 +9,7 @@ public class EnterNameState : IState
|
||||
private string name;
|
||||
public void enter()
|
||||
{
|
||||
gm = GameManager.instance;
|
||||
gm = GameManager.Instance;
|
||||
|
||||
textInput = gm.nameInput;
|
||||
textInput.gameObject.SetActive(true);
|
||||
|
||||
@ -16,7 +16,7 @@ public class EnterNumberTech : IState
|
||||
//private string name;
|
||||
public void enter()
|
||||
{
|
||||
gm = GameManager.instance;
|
||||
gm = GameManager.Instance;
|
||||
|
||||
textInput = gm.NumberTech;
|
||||
textInput.gameObject.SetActive(true);
|
||||
|
||||
@ -15,7 +15,7 @@ public class EnterPricePVERevengeState : IState
|
||||
|
||||
public void enter()
|
||||
{
|
||||
gm = GameManager.instance;
|
||||
gm = GameManager.Instance;
|
||||
|
||||
numberInput = gm.pricePveRevengeInput;
|
||||
numberInput.gameObject.SetActive(true);
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
public void enter()
|
||||
{
|
||||
gm = GameManager.instance;
|
||||
gm = GameManager.Instance;
|
||||
|
||||
numberInput = gm.pricePveInput;
|
||||
numberInput.gameObject.SetActive(true);
|
||||
|
||||
@ -15,7 +15,7 @@ public class EnterPricePVPState : IState
|
||||
|
||||
public void enter()
|
||||
{
|
||||
gm = GameManager.instance;
|
||||
gm = GameManager.Instance;
|
||||
|
||||
numberInput = gm.pricePvpInput;
|
||||
numberInput.gameObject.SetActive(true);
|
||||
|
||||
@ -16,7 +16,7 @@ public class EnterPrizesAvailableState : IState
|
||||
|
||||
public void enter()
|
||||
{
|
||||
gm = GameManager.instance;
|
||||
gm = GameManager.Instance;
|
||||
|
||||
numberInput = gm.prizesAvailableInput;
|
||||
numberInput.gameObject.SetActive(true);
|
||||
|
||||
@ -16,7 +16,7 @@ public class EnterPrizesForCharactersState : IState
|
||||
|
||||
public void enter()
|
||||
{
|
||||
rootPanel = GameManager.instance.CharactersConfigurator;
|
||||
rootPanel = GameManager.Instance.CharactersConfigurator;
|
||||
rootPanel.SetActive(true);
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ public class EnterPulsesToResetDifficulty : IState
|
||||
|
||||
public void enter()
|
||||
{
|
||||
gm = GameManager.instance;
|
||||
gm = GameManager.Instance;
|
||||
|
||||
numberInput = gm.pulsesToResetDifficultyInput;
|
||||
numberInput.gameObject.SetActive(true);
|
||||
|
||||
@ -16,7 +16,7 @@ public class EnterValutaNameState : IState
|
||||
//private string name;
|
||||
public void enter()
|
||||
{
|
||||
gm = GameManager.instance;
|
||||
gm = GameManager.Instance;
|
||||
|
||||
textInput = gm.ValutaNameInput;
|
||||
textInput.gameObject.SetActive(true);
|
||||
|
||||
@ -15,7 +15,7 @@ public class EnterValutaPerImpulse : IState
|
||||
|
||||
public void enter()
|
||||
{
|
||||
gm = GameManager.instance;
|
||||
gm = GameManager.Instance;
|
||||
|
||||
numberInput = gm.valutaPerPulseInput;
|
||||
numberInput.gameObject.SetActive(true);
|
||||
|
||||
@ -29,7 +29,7 @@ public class GetNumberState : IState
|
||||
public void enter()
|
||||
{
|
||||
//включить панель, получить доступ ко всем слотам
|
||||
entryPanel = GameManager.instance.NumberPanel;
|
||||
entryPanel = GameManager.Instance.NumberPanel;
|
||||
Debug.Log(entryPanel);
|
||||
entryPanel.SetActive(true);
|
||||
collectSlots();
|
||||
@ -74,7 +74,7 @@ public class GetNumberState : IState
|
||||
if (In.GetButtonDown(InSignal.down2))
|
||||
{
|
||||
//GameManager.instance.stateMachine.ChangeState(new SettingsState());
|
||||
GameManager.instance.stateMachine.ChangeState(prevState);
|
||||
GameManager.Instance.stateMachine.ChangeState(prevState);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -12,11 +12,11 @@ public class LeaderboardState : IState
|
||||
|
||||
public void enter()
|
||||
{
|
||||
leaderboard = GameManager.instance.leaderboard;
|
||||
leaderboard = GameManager.Instance.leaderboard;
|
||||
leaderboard.gameObject.SetActive(true);
|
||||
leaderboard.Initialize();
|
||||
|
||||
PlayerStatsRecord lastRecord = GameManager.instance.StatsService.GetLatestRecord();
|
||||
PlayerStatsRecord lastRecord = GameManager.Instance.StatsService.GetLatestRecord();
|
||||
leaderboard.DisplayCurrentPlayer(record);
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ public class LeaderboardState : IState
|
||||
if (In.GetButtonDownAnyPlayer(PlayerAction.left) && In.GetButtonDownAnyPlayer(PlayerAction.right))
|
||||
{
|
||||
Board.Instance.MakeClearField();
|
||||
GameManager.instance.GotoMenu();
|
||||
GameManager.Instance.GotoMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using PrizeSystem;
|
||||
using PrizeSystem;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
@ -17,8 +17,8 @@ public class PrizeState : IState
|
||||
}
|
||||
public void enter()
|
||||
{
|
||||
Debug.Log("Çàøåë â ïðèç");
|
||||
gm = GameManager.instance;
|
||||
Debug.Log("Зашел в приз");
|
||||
gm = GameManager.Instance;
|
||||
|
||||
gm.timerManager.StopAllTimers();
|
||||
if(PrizeSystemManager.HasVitrinaPrizeToGive)
|
||||
@ -42,7 +42,7 @@ public class PrizeState : IState
|
||||
}
|
||||
|
||||
}
|
||||
//äîáàâèòü qr ïàíåëü-âûäàò÷èê.
|
||||
//добавить qr панель-выдатчик.
|
||||
else
|
||||
{
|
||||
gm.stateMachine.ChangeState(nextState);
|
||||
|
||||
@ -33,7 +33,7 @@ public class PromoState : IState
|
||||
|
||||
if (anyInput || kinoVse)
|
||||
{
|
||||
GameManager.instance.GotoMenu();
|
||||
GameManager.Instance.GotoMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ public class RulesState : IState
|
||||
|
||||
public void enter()
|
||||
{
|
||||
rules = GameManager.instance.rulesController;
|
||||
rules = GameManager.Instance.rulesController;
|
||||
SoundManager.instance.playSwitch();
|
||||
rules.Open();
|
||||
restTime = timeout;
|
||||
@ -37,7 +37,7 @@ public class RulesState : IState
|
||||
if (In.GetButtonDownAnyPlayer(PlayerAction.down) || restTime <= 0)
|
||||
{
|
||||
rules.Close();
|
||||
GameManager.instance.GotoMenu();
|
||||
GameManager.Instance.GotoMenu();
|
||||
}
|
||||
restTime -= Time.deltaTime;
|
||||
}
|
||||
|
||||
@ -8,13 +8,13 @@ public class SettingsState : IState
|
||||
public void enter()
|
||||
{
|
||||
//SettingsManager.OnSettingsChanged?.Invoke();
|
||||
GameManager.instance.AdminPanel.SetActive(true);
|
||||
GameManager.Instance.AdminPanel.SetActive(true);
|
||||
elapsedTime = 0;
|
||||
}
|
||||
|
||||
public void exit()
|
||||
{
|
||||
GameManager.instance.AdminPanel.SetActive(false);
|
||||
GameManager.Instance.AdminPanel.SetActive(false);
|
||||
}
|
||||
|
||||
public void update()
|
||||
@ -22,7 +22,7 @@ public class SettingsState : IState
|
||||
if (ShouldExit())
|
||||
{
|
||||
SoundManager.instance.playChoose();
|
||||
GameManager.instance.GotoMenu();
|
||||
GameManager.Instance.GotoMenu();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,12 +2,12 @@
|
||||
{
|
||||
public void enter()
|
||||
{
|
||||
GameManager.instance.setPasswordPanel.SetActive(true);
|
||||
GameManager.Instance.setPasswordPanel.SetActive(true);
|
||||
}
|
||||
|
||||
public void exit()
|
||||
{
|
||||
GameManager.instance.setPasswordPanel.SetActive(false);
|
||||
GameManager.Instance.setPasswordPanel.SetActive(false);
|
||||
}
|
||||
|
||||
public void update()
|
||||
|
||||
@ -9,7 +9,7 @@ public class ShowWinnerState : IState
|
||||
Color empty = new Color(0, 0, 0, 0);
|
||||
|
||||
CoinCounter coinCounter;
|
||||
private GameManager gm = GameManager.instance;
|
||||
private GameManager gm = GameManager.Instance;
|
||||
|
||||
public enum ShowWinnerSubstates { PanelFalling, HandlingInputs, PanelRising, ExitByTime }
|
||||
public ShowWinnerSubstates subState;
|
||||
@ -159,7 +159,7 @@ public class ShowWinnerState : IState
|
||||
|
||||
//Фишка ходит первой если ее не побеждали сегодня еще
|
||||
//текущий бот - последний
|
||||
bool goingToLastBot = DifficultyManager.Instance.currentOpponent == GameManager.instance.botsAmount - 1;
|
||||
bool goingToLastBot = CharactersController.CurrentCharacter.CharacterIndex == GameManager.Instance.botsAmount - 1;
|
||||
if (goingToLastBot)
|
||||
{
|
||||
//Вопрос к логике тут.
|
||||
@ -171,7 +171,7 @@ public class ShowWinnerState : IState
|
||||
}
|
||||
else
|
||||
{
|
||||
Team nextPlayer = GameManager.instance.currentPlayer == Team.Player1 ? Team.Player2 : Team.Player2;
|
||||
Team nextPlayer = GameManager.Instance.currentPlayer == Team.Player1 ? Team.Player2 : Team.Player2;
|
||||
gm.PrepareRound(nextPlayer);
|
||||
}
|
||||
}
|
||||
@ -218,7 +218,7 @@ public class ShowWinnerState : IState
|
||||
DualAvatarController.Instance.HideCharacters();
|
||||
Board.Instance.MakeClearField();
|
||||
//GameManager.instance.stateMachine.ChangeState(new MenuState(fromGameplay: true));
|
||||
GameManager.instance.GotoMenu();
|
||||
GameManager.Instance.GotoMenu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ using UnityEngine;
|
||||
|
||||
public static class StateRouter
|
||||
{
|
||||
private static GameManager gm => GameManager.instance;
|
||||
private static GameManager gm => GameManager.Instance;
|
||||
public static void RouteAfterTurn()
|
||||
{
|
||||
//var checkResult = FieldChecker.Check(GameManager.instance.currentPlayer);
|
||||
@ -36,11 +36,11 @@ public static class StateRouter
|
||||
{
|
||||
LightUtility.Lose();
|
||||
CharactersController.CurrentCharacter.GetComponent<Animator>().SetTrigger("Win");
|
||||
DifficultyManager.Instance.DecreaseDifficulty();
|
||||
CharactersController.CurrentCharacter.difficultyModule.DecreaseDifficulty();
|
||||
if (gm.vsBotScore != 0)
|
||||
gm.vsBotScore -= 1;
|
||||
|
||||
CharacterEventBus.TriggerEvent(GameEvent.BotWin);
|
||||
EventBus.TriggerEvent(GameEvent.BotWin);
|
||||
|
||||
//gm.botScale.SetMedalsCount(gm.vsBotScore);
|
||||
|
||||
@ -98,9 +98,9 @@ public static class StateRouter
|
||||
}
|
||||
public static IState NextBot()
|
||||
{
|
||||
DifficultyManager.Instance.IncreaseDifficulty();
|
||||
CharactersController.CurrentCharacter.difficultyModule.IncreaseDifficulty();
|
||||
gm.vsBotScore += 1;
|
||||
CharacterEventBus.TriggerEvent(GameEvent.PlayerWin);
|
||||
EventBus.TriggerEvent(GameEvent.PlayerWin);
|
||||
|
||||
LightUtility.Win();
|
||||
|
||||
@ -108,7 +108,7 @@ public static class StateRouter
|
||||
|
||||
//если фишку победили, то повышаем.
|
||||
if (gm.vsBotScore == gm.botsAmount)
|
||||
DifficultyManager.Instance.upgradeFeeshkaDifficulty();
|
||||
GameManager.Instance.upgradeFeeshkaDifficulty();
|
||||
|
||||
if (TotalWin())
|
||||
{
|
||||
@ -121,7 +121,6 @@ public static class StateRouter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static IState PlayerWinPvpHandler(Team winner)
|
||||
{
|
||||
gm.IncreaseScore(winner);
|
||||
@ -144,14 +143,14 @@ public static class StateRouter
|
||||
|
||||
private static IState DrawHandler()
|
||||
{
|
||||
CharacterEventBus.TriggerEvent(GameEvent.Draw);
|
||||
EventBus.TriggerEvent(GameEvent.Draw);
|
||||
return new ShowWinnerState();
|
||||
}
|
||||
|
||||
public static IState ToMenu()
|
||||
{
|
||||
Board.Instance.MakeClearField();
|
||||
GameManager.instance.GotoMenu();
|
||||
GameManager.Instance.GotoMenu();
|
||||
return null;//
|
||||
}
|
||||
|
||||
@ -167,11 +166,4 @@ public static class StateRouter
|
||||
|
||||
private static bool TotalWin() =>
|
||||
gm.player1score == 5 || gm.player2score == 5 || gm.vsBotScore == gm.botsAmount;
|
||||
|
||||
//private static void ClearAllScales()//нужен менеджер шкал
|
||||
//{
|
||||
// if (gm.botScale.isActiveAndEnabled) gm.botScale.ClearScale();
|
||||
// if (gm.Player1Scale.isActiveAndEnabled) gm.Player1Scale.ClearScale();
|
||||
// if (gm.Player2Scale.isActiveAndEnabled) gm.Player2Scale.ClearScale();
|
||||
//}
|
||||
}
|
||||
|
||||
@ -30,12 +30,12 @@ public class TakeOrRiskState : IState
|
||||
if (character.prizeModule.TryFetchPrize(out Prize prize))
|
||||
PrizeSystemManager.GivePrize(prize);
|
||||
|
||||
GameManager.instance.stateMachine.ChangeState(new PrizeState(StateRouter.ToMenu()));
|
||||
GameManager.Instance.stateMachine.ChangeState(new PrizeState(StateRouter.ToMenu()));
|
||||
}
|
||||
else
|
||||
{
|
||||
//Следующий бот
|
||||
GameManager.instance.stateMachine.ChangeState(nextState);
|
||||
GameManager.Instance.stateMachine.ChangeState(nextState);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ public class VictoryState : IState
|
||||
public void enter()
|
||||
{
|
||||
LightUtility.Prize();
|
||||
gameManager = GameManager.instance;
|
||||
gameManager = GameManager.Instance;
|
||||
gameManager.timerManager.StopAllTimers();
|
||||
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ public class VictoryVideoState : IState
|
||||
|
||||
if (anyInput || kinoVse)
|
||||
{
|
||||
GameManager.instance.stateMachine.ChangeState(nextState);
|
||||
GameManager.Instance.stateMachine.ChangeState(nextState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ public class VitrinaChoseState : IState
|
||||
VitrinaPanel vitrinaPanel;
|
||||
public void enter()
|
||||
{
|
||||
vitrinaPanel = GameManager.instance.vitrinaPanel;
|
||||
vitrinaPanel = GameManager.Instance.vitrinaPanel;
|
||||
vitrinaPanel.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ public class GameManager : MonoBehaviour
|
||||
[Header("General")]
|
||||
public GameStateMachine stateMachine;
|
||||
|
||||
public static GameManager instance;
|
||||
public static GameManager Instance;
|
||||
public GameObject AdminPanel, NumberPanel;
|
||||
public TimerManager timerManager;
|
||||
public RulesController rulesController;
|
||||
@ -78,9 +78,9 @@ public class GameManager : MonoBehaviour
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (instance == null)
|
||||
if (Instance == null)
|
||||
{
|
||||
instance = this;
|
||||
Instance = this;
|
||||
}
|
||||
ComWrapper.PaymentReceived += ProcessDifficultyCounter;
|
||||
|
||||
@ -203,8 +203,7 @@ public class GameManager : MonoBehaviour
|
||||
if (gameMode == GameMode.pve)
|
||||
{
|
||||
timerManager.SetActiveTimer(Team.Player1);
|
||||
int difficultyIndex = DifficultyManager.Instance.currentOpponent;
|
||||
CharactersController.SwitchToCharacter(difficultyIndex);
|
||||
CharactersController.I.ShowCharacter(CharactersController.CharacterIndex);
|
||||
}
|
||||
else if (gameMode == GameMode.pvp)
|
||||
DualAvatarController.Instance.ShowCharacters();
|
||||
@ -236,7 +235,7 @@ public class GameManager : MonoBehaviour
|
||||
CharactersController.I.SetAllCharactersPrizeAvailable();
|
||||
DualAvatarController.Instance.HideCharacters();
|
||||
|
||||
DifficultyManager.Instance.ResetDifficulty();
|
||||
CharactersController.ResetSystem();
|
||||
|
||||
player1score = 0;
|
||||
player2score = 0;
|
||||
@ -247,6 +246,24 @@ public class GameManager : MonoBehaviour
|
||||
canReturnToMenu = true;
|
||||
}
|
||||
|
||||
|
||||
public void upgradeFeeshkaDifficulty()
|
||||
{
|
||||
string difficultyMode = SettingsManager.GetString(SettingKey.DIFFICULTY_MODE);
|
||||
//todo: разобраться
|
||||
//if (difficultyMode == "Прохождение")
|
||||
//{
|
||||
// PaymentSystem.ResetPulsesCounter();
|
||||
// Setting difficultySetting = SettingsManager.Container.TryGetSetting(SettingKeys.DIFFICULTY_MODE);
|
||||
// difficultySetting.StringValue = "Заработок";
|
||||
// SettingsManager.OnSettingsChanged?.Invoke();
|
||||
// SettingsManager.SaveContainerToFile();
|
||||
// GameManager.instance.AdminPanel.GetComponent<SettingsScreen>().RefreshViews();
|
||||
// print("Сложность повышена");
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
IEnumerator AddBotRecordEvery2Days()
|
||||
{
|
||||
while (true)
|
||||
|
||||
@ -33,7 +33,7 @@ public class COMinput : InputSource
|
||||
{
|
||||
try
|
||||
{
|
||||
gm = GameManager.instance;
|
||||
gm = GameManager.Instance;
|
||||
|
||||
// Загружаем конфигурацию пинов
|
||||
LoadPinMappingConfiguration();
|
||||
|
||||
@ -66,7 +66,7 @@ public class KeyboardInput : InputSource
|
||||
/// Инициализирует клавиатурный ввод. Всегда возвращает true так как клавиатура всегда доступна.
|
||||
/// </summary>
|
||||
/// <returns>Всегда true</returns>
|
||||
public override bool Initialize() => gm = GameManager.instance;
|
||||
public override bool Initialize() => gm = GameManager.Instance;
|
||||
|
||||
// ================================================================================
|
||||
// ВСПОМОГАТЕЛЬНЫЕ МЕТОДЫ
|
||||
|
||||
@ -55,7 +55,7 @@ public class Leaderboard : MonoBehaviour
|
||||
public void Initialize()
|
||||
{
|
||||
|
||||
gm = GameManager.instance;
|
||||
gm = GameManager.Instance;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -165,7 +165,7 @@ namespace PrizeSystem
|
||||
|
||||
private void Exit()
|
||||
{
|
||||
GameManager.instance.stateMachine.ChangeState(new SettingsState());
|
||||
GameManager.Instance.stateMachine.ChangeState(new SettingsState());
|
||||
}
|
||||
IEnumerator BlinkAnimation(Graphic graphic)
|
||||
{
|
||||
|
||||
@ -105,7 +105,7 @@ namespace PrizeSystem
|
||||
if(!CanSwipe) return;
|
||||
|
||||
int resultRank = rank + direction;
|
||||
if (resultRank >= 1 && resultRank <= GameManager.instance.botsAmount)
|
||||
if (resultRank >= 1 && resultRank <= GameManager.Instance.botsAmount)
|
||||
{
|
||||
rank = resultRank;
|
||||
TryPlayClick();
|
||||
|
||||
@ -35,7 +35,7 @@ public class VitrinaView : MonoBehaviour
|
||||
|
||||
public void ActivateIfNeed()
|
||||
{
|
||||
if (GameManager.instance.gameMode == GameMode.pvp)
|
||||
if (GameManager.Instance.gameMode == GameMode.pvp)
|
||||
{
|
||||
Deactivate();
|
||||
return;
|
||||
|
||||
@ -163,7 +163,7 @@ public class SoundManager : MonoBehaviour
|
||||
|
||||
audioSource.clip = clipToPlay;
|
||||
//audioSource.pitch = 1 + Random.Range(0, 2) * 0.6f;
|
||||
audioSource.pitch = GameManager.instance.currentPlayer == Team.Player1 ? 1 : 1.3f;
|
||||
audioSource.pitch = GameManager.Instance.currentPlayer == Team.Player1 ? 1 : 1.3f;
|
||||
audioSource.volume = effectsVolume;
|
||||
|
||||
|
||||
@ -186,7 +186,7 @@ public class SoundManager : MonoBehaviour
|
||||
|
||||
audioSource.clip = clipToPlay;
|
||||
audioSource.volume = effectsVolume;
|
||||
audioSource.pitch = GameManager.instance.currentPlayer == Team.Player1 ? 0.8f : 0.85f;
|
||||
audioSource.pitch = GameManager.Instance.currentPlayer == Team.Player1 ? 0.8f : 0.85f;
|
||||
|
||||
effect.SetActive(true);
|
||||
audioSource.Play();
|
||||
|
||||
@ -102,7 +102,7 @@ public class Board : MonoBehaviour
|
||||
private void PerformChipsClear()
|
||||
{
|
||||
SoundManager.instance.playExplosion();
|
||||
GameManager.instance.currentChip?.RemoveFromField();
|
||||
GameManager.Instance.currentChip?.RemoveFromField();
|
||||
if (Grid == null) return;
|
||||
|
||||
foreach (Chip chip in Grid)
|
||||
|
||||
@ -12,6 +12,8 @@ public class Bot : BasePlayer, IGamePlayer
|
||||
[SerializeField] private bool useDummyBots = false;
|
||||
[SerializeField] private float minThinkingTime = 1f;
|
||||
|
||||
public DifficultyPreset dummyPreset;
|
||||
|
||||
// State
|
||||
private PlayerState state = PlayerState.Sleep;
|
||||
private Chip currentChip;
|
||||
@ -152,8 +154,8 @@ public class Bot : BasePlayer, IGamePlayer
|
||||
try
|
||||
{
|
||||
DifficultyPreset currentPreset = difficultyPreset;
|
||||
if (useDummyBots && DifficultyManager.Instance != null)
|
||||
currentPreset = DifficultyManager.Instance.DummyPreset;
|
||||
if (useDummyBots)
|
||||
currentPreset = dummyPreset;
|
||||
|
||||
if (currentPreset != null && board != null)
|
||||
{
|
||||
@ -162,7 +164,7 @@ public class Bot : BasePlayer, IGamePlayer
|
||||
Solver.SetPreset(currentPreset);
|
||||
}
|
||||
|
||||
GameManager gm = GameManager.instance;
|
||||
GameManager gm = GameManager.Instance;
|
||||
if (gm != null)
|
||||
{
|
||||
bool onBossByScore = gm.vsBotScore == gm.botsAmount - 1;
|
||||
|
||||
@ -1,73 +0,0 @@
|
||||
using CharacterSystem;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class DifficultyManager : MonoBehaviour
|
||||
{
|
||||
|
||||
private static DifficultyManager instance;
|
||||
public static DifficultyManager Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = FindAnyObjectByType<DifficultyManager>();
|
||||
|
||||
if (instance == null)
|
||||
{
|
||||
Debug.LogWarning($"Не найден {typeof(DifficultyManager)}");
|
||||
}
|
||||
else
|
||||
{
|
||||
instance.currentOpponent = 0;
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public UnityEvent OnVictory = new UnityEvent();
|
||||
public int currentOpponent = 0;
|
||||
|
||||
public DifficultyPreset DummyPreset;
|
||||
public bool dummyBots = false;
|
||||
public void IncreaseDifficulty()
|
||||
{
|
||||
if (currentOpponent + 1 == CharactersController.CharactersAmount)//победили самую большую сложность
|
||||
{
|
||||
OnVictory?.Invoke();
|
||||
}
|
||||
CharactersController.CurrentCharacter.difficultyModule.IncreaseDifficuly();//увеличиваем сложность у того с кем бились
|
||||
currentOpponent = (currentOpponent + 1) % CharactersController.CharactersAmount;//если победили последнего, то возвращаемся на первого
|
||||
}
|
||||
public void DecreaseDifficulty()
|
||||
{
|
||||
CharactersController.CurrentCharacter.difficultyModule.DecreaseDifficuly();//уменьшаем сложность у того с кем бились
|
||||
if (currentOpponent != 0)
|
||||
{
|
||||
currentOpponent--;
|
||||
}
|
||||
}
|
||||
public void ResetDifficulty()
|
||||
{
|
||||
currentOpponent = 0;
|
||||
CharactersController.ResetAllCharactersDifficulty();
|
||||
}
|
||||
|
||||
public void upgradeFeeshkaDifficulty()
|
||||
{
|
||||
string difficultyMode = SettingsManager.GetString(SettingKey.DIFFICULTY_MODE);
|
||||
//todo: разобраться
|
||||
// if (difficultyMode == "Прохождение")
|
||||
// {
|
||||
// PaymentSystem.ResetPulsesCounter();
|
||||
// Setting difficultySetting = SettingsManager.Container.TryGetSetting(SettingKeys.DIFFICULTY_MODE);
|
||||
// difficultySetting.StringValue = "Заработок";
|
||||
// SettingsManager.OnSettingsChanged?.Invoke();
|
||||
// SettingsManager.SaveContainerToFile();
|
||||
// GameManager.instance.AdminPanel.GetComponent<SettingsScreen>().RefreshViews();
|
||||
// print("Сложность повышена");
|
||||
// }
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05be8fefee27c564fbb37e319abd33b1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
public static class EndOfTurnHandler
|
||||
{
|
||||
private static GameManager gm => GameManager.instance;
|
||||
private static GameManager gm => GameManager.Instance;
|
||||
|
||||
private static bool TotalWin() =>
|
||||
gm.player1score == 5 || gm.player2score == 5 || gm.vsBotScore == gm.botsAmount;
|
||||
@ -46,8 +46,8 @@ public static class EndOfTurnHandler
|
||||
|
||||
//НЕ НИЧЬЯ
|
||||
//VictoryScale vsBotScale = gm.botScale;
|
||||
DifficultyManager.Instance.DecreaseDifficulty();
|
||||
CharacterEventBus.TriggerEvent(GameEvent.BotWin);
|
||||
CharactersController.CurrentCharacter.difficultyModule.DecreaseDifficulty();
|
||||
EventBus.TriggerEvent(GameEvent.BotWin);
|
||||
if (gm.vsBotScore != 0) gm.vsBotScore -= 1;
|
||||
|
||||
//vsBotScale.SetMedalsCount(gm.vsBotScore);
|
||||
|
||||
@ -30,7 +30,7 @@ public class MovesAndTimeCounter : MonoBehaviour
|
||||
public void Initialize()
|
||||
{
|
||||
SetVisibility(false);
|
||||
gm = GameManager.instance;
|
||||
gm = GameManager.Instance;
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
||||
@ -30,7 +30,7 @@ public class DualAvatarController : MonoBehaviour
|
||||
|
||||
|
||||
[SerializeField] private float CharacterMovementSpeed = 5000;
|
||||
public Avatar CurrentAvatar => avatars[GameManager.instance.currentPlayer];
|
||||
public Avatar CurrentAvatar => avatars[GameManager.Instance.currentPlayer];
|
||||
public static DualAvatarController Instance;
|
||||
private bool spawned = false;
|
||||
|
||||
|
||||
@ -9,6 +9,6 @@ public class DrawAgainButton : PveLossButton
|
||||
if (!interactable) return;
|
||||
|
||||
base.Interact();
|
||||
GameManager.instance.PerformDrawRevenge();
|
||||
GameManager.Instance.PerformDrawRevenge();
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,6 @@
|
||||
if(!interactable) return;
|
||||
|
||||
base.Interact();
|
||||
GameManager.instance.GotoMenu();
|
||||
GameManager.Instance.GotoMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,9 +68,9 @@ public class PveLossPanel : MonoBehaviour, IControlable
|
||||
foreach (var button in buttons)
|
||||
button.OnInteract -= Close;
|
||||
if(buttonIndex == 0)
|
||||
GameManager.instance.PerformRevenge();
|
||||
GameManager.Instance.PerformRevenge();
|
||||
else
|
||||
GameManager.instance.GotoMenu();
|
||||
GameManager.Instance.GotoMenu();
|
||||
|
||||
|
||||
if (_animation != null)
|
||||
|
||||
@ -102,7 +102,7 @@ public class PvpWinPanel : MonoBehaviour, IControlable
|
||||
description.localScale = Vector3.zero;
|
||||
|
||||
var text = description.GetComponent<TextMeshProUGUI>();
|
||||
int winner = GameManager.instance.currentPlayer == Team.Player1 ? 1 : 2;
|
||||
int winner = GameManager.Instance.currentPlayer == Team.Player1 ? 1 : 2;
|
||||
text.text = $"игрок {winner} победил";
|
||||
|
||||
revengeButton.Initialize();
|
||||
|
||||
@ -96,6 +96,6 @@ public class TurnManager : MonoBehaviour
|
||||
Team lastPlayerTeam = ((BasePlayer)currentPlayer).team;
|
||||
var result = FieldChecker.lastResult;
|
||||
|
||||
GameManager.instance.endGameHandler.HandleEndGame(lastPlayerTeam, gameMode, result);
|
||||
GameManager.Instance.endGameHandler.HandleEndGame(lastPlayerTeam, gameMode, result);
|
||||
}
|
||||
}
|
||||
@ -31,7 +31,7 @@ public class MenuController : MonoBehaviour
|
||||
{
|
||||
_isEnabled = true;
|
||||
LightUtility.Idle();
|
||||
GameManager.instance.ResetGameSession();
|
||||
GameManager.Instance.ResetGameSession();
|
||||
}
|
||||
|
||||
public void Disable()
|
||||
|
||||
@ -102,7 +102,7 @@ public class GamemodePanel : MenuPanel
|
||||
.WithCancellation(cts.Token);
|
||||
}
|
||||
|
||||
public override void Interact() => GameManager.instance.TryEnterGame(gameMode);
|
||||
public override void Interact() => GameManager.Instance.TryEnterGame(gameMode);
|
||||
|
||||
private void StopAnimation()
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user