public LevelManager(IUpdateManager updateManager, IObjectStorage objectStorage) { _updateManager = updateManager; _objectStorage = objectStorage; _updateManager.AddUpdatable(this); }
public void SetUp() { _board.Initial(); _checkManager.Board = _board; _uiManager.NavigationManager = _NavigationManager; _gameplayLogicManager.Board = _board; _gameplayLogicManager.Notifier = _taskNotifier; _gameplayLogicManager.CheckManager = _checkManager; _gameplayLogicManager.SpawnManager = _spawnManager; _gameplayLogicManager.NavigationManager = _NavigationManager; _taskManager.Notifier = _gameplayNotifier; _buttonsManager.AddSubscriber(_uiManager); _taskManager.AddSubscriber(_gameplayLogicManager); _inputManager.AddSubscriber(_gameplayLogicManager); _gameplayLogicManager.AddSubscriber(_taskManager); _gameplayLogicManager.AddSubscriber(_uiManager); _updateManager.AddUpdatable(_inputManager as IUpdatable); _updateManager.IsUpdate = true; _buttonsManager.Notify(EventTypesEnum.UI_SceneLoaded, null); }
public PlatformManager(IUpdateManager updateManager, IObjectStorage objectStorage) { _objectStorage = objectStorage; _updateManager = updateManager; _updateManager.AddUpdatable(this); _slowPlatform = Constants.countSlowPlatform; }
public ControlManager(IUpdateManager updateManager, IObjectStorage objectStorage) { _updateManager = updateManager; _objectStorage = objectStorage; _updateManager.AddUpdatable(this); _list = new List <Collider2D>(); _contactFilter2D = new ContactFilter2D(); CurrentControlType = ControlType.Default; }
public BehaviourManager(IUpdateManager updateManager, IObjectStorage objectStorage) { _updateManager = updateManager; _objectStorage = objectStorage; _unitBehaviours = new UnitBehaviours(_objectStorage); _bulletBehaviours = new BulletBehaviours(_objectStorage); _bonusBehaviour = new BonusBehaviour(_objectStorage); _upgradeBehaviours = new UpgradeBehaviours(_objectStorage); _obstacleBehaviour = new ObstacleBehaviour(_objectStorage); _updateManager.AddUpdatable(this); }
public IEnumerator Cell_SwapAndUndo(SwapTypes swapType) { #region Create Managers IMasterManager masterManager = ObjectsCreator.CreateMasterManager(); ISpawnManager spawnManager = masterManager.SpawnManager; INotifier notifier = masterManager.GameplayNotifier; IUpdateManager updateManager = masterManager.UpdateManager; ICellRegistrator cellRegistrator = new CellRegistrator(notifier, updateManager); #endregion #region Create Cell Vector3 position = new Vector3(1, 1, 0); ICell cellA = spawnManager.SpawnRandomNormalCell(position); cellRegistrator.RegistrateNormalCell(cellA as NormalCell); #endregion #region SetUp UpdateManager updateManager.AddUpdatable(cellA as IUpdatable); updateManager.IsUpdate = true; #endregion yield return(new WaitForSeconds(0.3f)); #region Swap Cell and do Undo ICommand swapCommand = TestHelper.GetSwapCommand(swapType, cellA); swapCommand.Execute(); yield return(new WaitForSeconds(0.5f)); swapCommand.Undo(); #endregion #region Remove From Scene yield return(new WaitForSeconds(0.5f)); GameObject.Destroy(cellA.CurrentGameObject); #endregion }
public void Setting() { _checkManager.Board = _board; _logicManager.Board = _board; _logicManager.CheckManager = _checkManager; _logicManager.SpawnManager = _spawnManager; _inputManager.AddSubscriber(_logicManager); _updateManager.AddUpdatable(_inputManager as IUpdatable); _logicManager.SpawnYPos = _board.Height; _logicManager.FindMatches(); _updateManager.IsUpdate = true; }
} //представление двумерного массива Elements в виде двумерного массива GameObject //Cells[i, j], где i - координата по X и j - координата по Y //В процессе работы меняются только свойства объектов, сами они всегда соответствуют своим координатам и неподвижны public LogicManager(IObjectsStorage objectsStorage, IUpdateManager updateManager, ILevelManager levelManager, IElementsCreator elementsCreator) { _objectsStorage = objectsStorage; _updateManager = updateManager; _levelManager = levelManager; _elementsCreator = elementsCreator; _updateManager.AddUpdatable(this); Rows = 12; // Columns = 12; //в персперктиве данные должны быть получени извне _isSelect = false; _isReady = false; _isRemove = false; Cells = new GameObject[Columns, Rows]; LoadResources(); }
public UIManager(IUpdateManager updateManager, IControlManager controlManager, IPlatformManager platformManager, IObjectStorage objectStorage) { _updateManager = updateManager; _controlManager = controlManager; _platformManager = platformManager; _objectStorage = objectStorage; _updateManager.AddUpdatable(this); _buttons = new Dictionary <string, Button>(); _buttons.Add(Constants.playBatton, GameObject.Find(Constants.playBatton).GetComponent <Button>()); _buttons.Add(Constants.restartButton, GameObject.Find(Constants.restartButton).GetComponent <Button>()); _buttons.Add(Constants.continueButton, GameObject.Find(Constants.continueButton).GetComponent <Button>()); _buttons.Add(Constants.optionsButton, GameObject.Find(Constants.optionsButton).GetComponent <Button>()); _buttons.Add(Constants.menuButton, GameObject.Find(Constants.menuButton).GetComponent <Button>()); _buttons.Add(Constants.exitButton, GameObject.Find(Constants.exitButton).GetComponent <Button>()); _buttons.Add(Constants.WASDControl, GameObject.Find(Constants.WASDControl).GetComponent <Button>()); _buttons.Add(Constants.arrayControl, GameObject.Find(Constants.arrayControl).GetComponent <Button>()); _buttons.Add(Constants.backButton, GameObject.Find(Constants.backButton).GetComponent <Button>()); _mainMenu = GameObject.Find(Constants.mainMenu); _mainMenu.SetActive(false); _optionsMenu = GameObject.Find(Constants.optionsMenu); _optionsMenu.SetActive(false); _currentScore = GameObject.Find(Constants.currentScore).GetComponent <TextMeshProUGUI>(); _currentScore.gameObject.SetActive(false); _gameOverMenu = GameObject.Find(Constants.gameOverMenu); _totalScore = GameObject.Find(Constants.totalScore).GetComponent <TextMeshProUGUI>(); _gameOverMenu.SetActive(false); _buttons[Constants.playBatton].onClick.AddListener(delegate() { StartLevel(); }); _buttons[Constants.restartButton].onClick.AddListener(delegate() { StartLevel(); }); _buttons[Constants.continueButton].onClick.AddListener(delegate() { ContinueLevel(); }); _buttons[Constants.optionsButton].onClick.AddListener(delegate() { Open_optionsMenu(); }); _buttons[Constants.exitButton].onClick.AddListener(delegate() { QuitApplication(); }); _buttons[Constants.WASDControl].onClick.AddListener(delegate() { SelectWASDControl(); }); _buttons[Constants.arrayControl].onClick.AddListener(delegate() { SelectArrayControl(); }); _buttons[Constants.backButton].onClick.AddListener(delegate() { BackTo_mainMenu(); }); _buttons[Constants.menuButton].onClick.AddListener(delegate() { Open_mainMenu(); }); }
public void RegistrateNormalCell(NormalCell cell) { cell.Notifier = _gameplayNotifier; _updateManager.AddUpdatable(cell); }
public IEnumerator PowerUp_UseTwoPowerUp_Review(PowerUpTypesEnum powerUpTypeEnumA, PowerUpTypesEnum powerUpTypeEnumB) { #region Create Managers IMasterManager masterManager; ICellRegistrator cellRegistrator; IBoard board = ObjectsCreator.CreateBoard(9, 9, out masterManager, out cellRegistrator); IUpdateManager updateManager = masterManager.UpdateManager; IGameplayLogicManager gameplayLogicManager = ObjectsCreator.CreateGameplayLogicManager(); INotifier gameplayNotifier = masterManager.GameplayNotifier; ISpawnManager spawnManager = masterManager.SpawnManager; IInputManager inputManager = new InputManager(gameplayNotifier); ICheckManager checkManager = new CheckManager(); #endregion #region Create And SetUp Cells with PowerUp IList <ICell> cellsWithPowerUp = new List <ICell>(); IList <Vector3> positions = new List <Vector3>(); switch (powerUpTypeEnumA) { case PowerUpTypesEnum.Bomb: positions.Add(new Vector2(4, 4)); positions.Add(new Vector2(2, 4)); break; case PowerUpTypesEnum.Vertical: positions.Add(new Vector2(3, 3)); positions.Add(new Vector2(3, 6)); break; case PowerUpTypesEnum.Horizontal: positions.Add(new Vector2(3, 3)); positions.Add(new Vector2(6, 3)); break; } for (int i = 0; i < 2; i++) { ICell cell = new NormalCell((int)positions[i].x, (int)positions[i].y); Vector3 cellPosition = new Vector2((int)positions[i].x, (int)positions[i].y); cell.CurrentGameObject = spawnManager.SpawnPowerPrefab(i == 0 ? powerUpTypeEnumA : powerUpTypeEnumB, positions[i]); cellRegistrator.RegistrateNormalCell(cell as NormalCell); board.Cells[cell.TargetX, cell.TargetY] = cell; cellsWithPowerUp.Add(cell); } #endregion yield return(new WaitForSeconds(0.1f)); #region SetUp Board and Managers board.Initial(); checkManager.Board = board; gameplayLogicManager.Board = board; gameplayLogicManager.CheckManager = checkManager; gameplayLogicManager.SpawnManager = spawnManager; gameplayLogicManager.Notifier = new Notifier(); inputManager.AddSubscriber(gameplayLogicManager); updateManager.AddUpdatable(inputManager as IUpdatable); updateManager.IsUpdate = true; #endregion yield return(new WaitForSeconds(0.3f)); #region Try Use PowerUp int swipeCount = 2; gameplayLogicManager.TryCheckSwipedCells(cellsWithPowerUp[0], swipeCount); #endregion #region Remove From Scene yield return(new WaitForSeconds(2f)); updateManager.IsUpdate = false; foreach (var cell in board.Cells) { GameObject.Destroy(cell.CurrentGameObject); } #endregion }
public IEnumerator PowerUp_UseOnePowerUp_Review(PowerUpTypesEnum powerUpTypeEnum) { #region Create Managers IMasterManager masterManager; ICellRegistrator cellRegistrator; IBoard board = ObjectsCreator.CreateBoard(9, 9, out masterManager, out cellRegistrator); IUpdateManager updateManager = masterManager.UpdateManager; IGameplayLogicManager gameplayLogicManager = ObjectsCreator.CreateGameplayLogicManager(); INotifier gameplayNotifier = masterManager.GameplayNotifier; ISpawnManager spawnManager = masterManager.SpawnManager; IInputManager inputManager = new InputManager(gameplayNotifier); ICheckManager checkManager = new CheckManager(); #endregion #region Create And SetUp Cell with PowerUp ICell cellWithPowerUp = new NormalCell(4, 4); Vector3 cellPosition = new Vector2(4, 4); cellWithPowerUp.CurrentGameObject = spawnManager.SpawnPowerPrefab(powerUpTypeEnum, cellPosition); cellRegistrator.RegistrateNormalCell(cellWithPowerUp as NormalCell); board.Cells[cellWithPowerUp.TargetX, cellWithPowerUp.TargetY] = cellWithPowerUp; #endregion yield return(new WaitForSeconds(0.1f)); #region SetUp Board and Managers board.Initial(); checkManager.Board = board; gameplayLogicManager.Board = board; gameplayLogicManager.CheckManager = checkManager; gameplayLogicManager.SpawnManager = spawnManager; gameplayLogicManager.Notifier = new Notifier(); inputManager.AddSubscriber(gameplayLogicManager); updateManager.AddUpdatable(inputManager as IUpdatable); updateManager.IsUpdate = true; #endregion yield return(new WaitForSeconds(0.3f)); #region Try Use PowerUp int swipeCount = 2; gameplayLogicManager.TryCheckSwipedCells(cellWithPowerUp, swipeCount); #endregion #region Remove From Scene yield return(new WaitForSeconds(2f)); updateManager.IsUpdate = false; foreach (var cell in board.Cells) { GameObject.Destroy(cell.CurrentGameObject); } #endregion }
public void SetNormalCell(INormalCell normalCell, GameObject go) { normalCell.CurrentGameObject = go; normalCell.Notifier = _notifier; _updateManager.AddUpdatable(normalCell); }
public IEnumerator Cells_TryCheck(int equalsCellsCount, bool isVertical) { #region Create Managers And Board IMasterManager masterManager; ICellRegistrator cellRegistrator; IBoard board = ObjectsCreator.CreateBoard(equalsCellsCount + 3, equalsCellsCount + 3, out masterManager, out cellRegistrator); IUpdateManager updateManager = masterManager.UpdateManager; IGameplayLogicManager gameplayLogicManager = ObjectsCreator.CreateGameplayLogicManager(); INotifier gameplayNotifier = masterManager.GameplayNotifier; ISpawnManager spawnManager = masterManager.SpawnManager; IInputManager inputManager = new InputManager(gameplayNotifier); ICheckManager checkManager = new CheckManager(); #endregion #region Create Cells int startX = 2; int startY = 2; ICell swipedCell = null; for (int i = 0; i < equalsCellsCount; i++) { int x = startX; int y = startY; if (isVertical) { if (i == Mathf.Floor(equalsCellsCount / 2)) { x = startX + 1; } else { x = startX; } y = startY + i; } else { if (i == Mathf.Floor(equalsCellsCount / 2)) { y = startY + 1; } else { y = startY; } x = startX + i; } ICell cell = new NormalCell(x, y); cell.CurrentGameObject = spawnManager.SpawnPrefab(GameElementTypesEnum.RedCircle, new Vector3(x, y, 0)); cellRegistrator.RegistrateNormalCell(cell as NormalCell); board.Cells[cell.TargetX, cell.TargetY] = cell; if (i == Mathf.Floor(equalsCellsCount / 2)) { swipedCell = board.Cells[cell.TargetX, cell.TargetY]; } } #endregion yield return(new WaitForSeconds(1f)); #region SetUp Board And Managers board.Initial(); checkManager.Board = board; gameplayLogicManager.Board = board; gameplayLogicManager.CheckManager = checkManager; gameplayLogicManager.SpawnManager = spawnManager; gameplayLogicManager.Notifier = masterManager.UINotifier; inputManager.AddSubscriber(gameplayLogicManager); updateManager.AddUpdatable(inputManager as IUpdatable); updateManager.IsUpdate = true; #endregion yield return(new WaitForSeconds(1f)); #region Create And SetUp MacroCommand to use swap cells ICommand[] commands; if (isVertical) { commands = new ICommand[] { new SwipeLeftCommand(swipedCell), new SwipeRightCommand(board.Cells[swipedCell.TargetX - 1, swipedCell.TargetY]), }; } else { commands = new ICommand[] { new SwipeDownCommand(swipedCell), new SwipeUpCommand(board.Cells[swipedCell.TargetX, swipedCell.TargetY - 1]), }; } ICommand macroCommand = new MacroCommand(commands); gameplayLogicManager.MacroCommand = macroCommand; #endregion #region Try Swap Cells and get Check gameplayLogicManager.MacroCommand.Execute(); yield return(new WaitForSeconds(1f)); gameplayLogicManager.TryCheckSwipedCells(swipedCell); #endregion #region Remove From Scene yield return(new WaitForSeconds(0.2f)); updateManager.IsUpdate = false; foreach (var boadrdCell in board.Cells) { updateManager.RemoveUpdatable(boadrdCell as IUpdatable); } foreach (var cell in board.Cells) { GameObject.Destroy(cell.CurrentGameObject); } #endregion }
public UIManager(IUpdateManager updateManager, IObjectStorage objectStorage, IPoolManager poolManager, IDataLoadManager dataLoadManager, IBehaviourManager behaviourManager) { _updateManager = updateManager; _objectStorage = objectStorage; _poolManager = poolManager; _dataLoadManager = dataLoadManager; _behaviourManager = behaviourManager; _updateManager.AddUpdatable(this); _buttons = new Dictionary <string, Button>(); _mainMenu = GameObject.Find("MainMenu"); _gameMenu = GameObject.Find("GameMenu"); _buttons.Add(Constants.playBatton, GameObject.Find(Constants.playBatton).GetComponent <Button>()); _buttons.Add(Constants.exitButton, GameObject.Find(Constants.exitButton).GetComponent <Button>()); _buttons.Add(Constants.pauseButton, GameObject.Find(Constants.pauseButton).GetComponent <Button>()); _buttons.Add(Constants.continueButton, GameObject.Find(Constants.continueButton).GetComponent <Button>()); _buttons.Add(Constants.restartButton, GameObject.Find(Constants.restartButton).GetComponent <Button>()); _buttons.Add(Constants.backButton, GameObject.Find(Constants.backButton).GetComponent <Button>()); _buttons.Add(Constants.firstUpgradeButton, GameObject.Find(Constants.firstUpgradeButton).GetComponent <Button>()); _buttons.Add(Constants.secondUpgradeButton, GameObject.Find(Constants.secondUpgradeButton).GetComponent <Button>()); _buttons.Add(Constants.thirdUpgradeButton, GameObject.Find(Constants.thirdUpgradeButton).GetComponent <Button>()); _buttons.Add(Constants.machineButton, GameObject.Find(Constants.machineButton).GetComponent <Button>()); _buttons.Add(Constants.weaponApplyButton, GameObject.Find(Constants.weaponApplyButton).GetComponent <Button>()); _buttons[Constants.playBatton].onClick.AddListener(delegate() { StartLevel(); }); _buttons[Constants.exitButton].onClick.AddListener(delegate() { QuitApplication(); }); _buttons[Constants.pauseButton].onClick.AddListener(delegate() { OpenGameMenu(); }); _buttons[Constants.continueButton].onClick.AddListener(delegate() { ContinueLevel(); }); _buttons[Constants.restartButton].onClick.AddListener(delegate() { RestartLevel(); }); _buttons[Constants.backButton].onClick.AddListener(delegate() { OpenMainMenu(); }); _buttons[Constants.firstUpgradeButton].onClick.AddListener(delegate() { ApplyFirstUpgrade(); }); _buttons[Constants.secondUpgradeButton].onClick.AddListener(delegate() { ApplySecondUpgrade(); }); _buttons[Constants.thirdUpgradeButton].onClick.AddListener(delegate() { ApplyThirdUpgrade(); }); _buttons[Constants.machineButton].onClick.AddListener(delegate() { OpenMachineMenu(); }); _buttons[Constants.weaponApplyButton].onClick.AddListener(delegate() { WeaponApplyMenu(); }); _healthBar = GameObject.Find("Healthbar").GetComponent <Slider>(); _experiencebar = GameObject.Find("Experiencebar").GetComponent <Slider>(); _upgradeMenu = GameObject.Find("UpgradeMenu"); _firstTitle = GameObject.Find("FirstTitle").GetComponent <TextMeshProUGUI>(); _firstDescription = GameObject.Find("FirstDescription").GetComponent <TextMeshProUGUI>(); _secondTitle = GameObject.Find("SecondTitle").GetComponent <TextMeshProUGUI>(); _secondDescription = GameObject.Find("SecondDescription").GetComponent <TextMeshProUGUI>(); _thirdTitle = GameObject.Find("ThirdTitle").GetComponent <TextMeshProUGUI>(); _thirdDescription = GameObject.Find("ThirdDescription").GetComponent <TextMeshProUGUI>(); _coinPanel = GameObject.Find("CoinPanel"); _coinValue = GameObject.Find("CoinValue").GetComponent <TextMeshProUGUI>(); _magazinePanel = GameObject.Find("MagazinePanel"); _bulletImagePrefab = Resources.Load(Constants.prefabPath + "BulletImage") as GameObject; _bulletImages = new List <GameObject>(); _machineMenu = GameObject.Find("MachineMenu"); _machineDropdown = GameObject.Find("MachineDropdown").GetComponent <TMP_Dropdown>(); _machineDropdown.options = new List <TMP_Dropdown.OptionData> { new TMP_Dropdown.OptionData(_objectStorage.WeaponTemplates[WeaponType.PlayerBlaster.ToString()].Alias), new TMP_Dropdown.OptionData(_objectStorage.WeaponTemplates[WeaponType.PlayerShotgun.ToString()].Alias), }; _machineDropdown.onValueChanged.AddListener(delegate { MachineDropdownValueChangedHandler(_machineDropdown); }); _weaponDescription = GameObject.Find("WeaponDescription").GetComponent <TextMeshProUGUI>(); }