public WorldObjectsController(IWorldObjectsGenerator worldObjectsGenerator, int playerCount, Material[] playerMaterials) { _playerCount = playerCount; _worldObjectsGenerator = worldObjectsGenerator; _playerMaterials = playerMaterials; PlayerController.PlayerAttackEvent += OnPlayerAttack; PlayerController.PlayerDiedEvent += OnPlayerDeath; GameController.GameRestartedEvent += OnGameRestarted; GameController.GameEndedEvent += OnGameEnded; InitializePlayerGameObjects(); }
private void Awake() { IResourcesRepository resourcesRepository = new ResourcesRepository(); IUiGeneratorFactory uiGeneratorFactory = new UiGeneratorFactory(gameObject, resourcesRepository); var uiElementsGenerator = uiGeneratorFactory.UiElementsGenerator; uiElementsGenerator.InitializeGenerator(resourcesRepository); InitializeRestartButtons(uiElementsGenerator); IBuffRepositoryFactory buffRepoFactory = new BuffRepositoryFactory(resourcesRepository); var buffsRepository = buffRepoFactory.BuffsRepository; new PlayerUiControllerFactory(resourcesRepository, uiElementsGenerator); new PlayerControllerFactory(buffsRepository, resourcesRepository); IWorldObjectsGenerator worldGenerator = GetComponent <WorldObjectsGenerator>(); worldGenerator.PlayerModelPrefab = resourcesRepository.GetPlayerModelPrefab(); new WorldObjectControllerFactory(worldGenerator, resourcesRepository, materials); StartDefaultGame(); }
public WorldObjectControllerFactory(IWorldObjectsGenerator worldObjectsGenerator, IResourcesRepository resourcesRepository, Material[] materials) { WorldObjectController = new WorldObjectsController(worldObjectsGenerator, resourcesRepository.GameSettings.PlayersCount, materials); }