public BonusController(DisplayEndGame displayEndGame, DisplayBonuses displayBonuses, GameObject restartBotton) { _bonuses = new ListInteractiveObject(); _displayEndGame = displayEndGame; _displayBonuses = displayBonuses; _restartBotton = restartBotton; Subscription(); }
public void Execute(float deltaTime) { _playerBase.Move(Input.GetAxis(AxisManager.HORIZONTAL), 0.0f, Input.GetAxis(AxisManager.VERTICAL)); if (Input.GetKeyDown(_savePlayer)) { _interactiveObject = new ListInteractiveObject(); _goodBonusNumber = 0; _bedBonusNumber = 0; for (int i = 0; i < _interactiveObject.Length; i++) { if (_interactiveObject[i] is GoodBonus goodBonus) { _saveGoodDataRepository.Save(goodBonus, _goodBonusNumber); _goodBonusNumber += 1; } if (_interactiveObject[i] is BadBonus badBonus) { _saveBedDataRepository.Save(badBonus, _bedBonusNumber); _bedBonusNumber += 1; } _saveDataRepository.Save(_playerBase); } } if (Input.GetKeyDown(_loadPlayer)) { _interactiveObject = new ListInteractiveObject(); _goodBonusNumber = 0; _bedBonusNumber = 0; for (int i = 0; i < _interactiveObject.Length; i++) { if (_interactiveObject[i] is GoodBonus goodBonus) { _saveGoodDataRepository.Load(goodBonus, _goodBonusNumber); _goodBonusNumber += 1; } if (_interactiveObject[i] is BadBonus badBonus) { _saveBedDataRepository.Load(badBonus, _bedBonusNumber); _goodBonusNumber += 1; } _saveDataRepository.Load(_playerBase); } } }