Пример #1
0
        public void Init(HealthSystem healthSystem,
                         AbilitySystem abilitySystem,
                         Transform abilitiesContainer,
                         MainCameraStorage mainCameraStorage,
                         Slider playerHealth,
                         InputManager inputManager)
        {
            _healthSystem         = healthSystem;
            _playerHealth         = playerHealth;
            _abilitySystem        = abilitySystem;
            _machineGunVisualizer = new MachineGunVisualizer(_machineGunLineRenderer, _machineGunLineDuration);
            var deps = new TankDeps(_machineGunVisualizer);

            abilitySystem.Init(_abilities, new ToParentFactory <AbilityUi, IAbilityUi>(_abilityUiPrefab, abilitiesContainer), in deps);
            mainCameraStorage.Set(_playerCamera);

            _inputManager = inputManager;
            inputManager.OnAbilityPressed         += () => { _abilitySystem.Fire(in _abilityContext); };
            inputManager.OnNextAbilityPressed     += _abilitySystem.NextAbility;
            inputManager.OnPreviousAbilityPressed += _abilitySystem.PreviousAbility;

            _abilityContext = new AbilityContext(transform, _towerEnd);
            base.Init(healthSystem);
        }
Пример #2
0
 public EntityDeps(EntitiesSpawner entitiesStorage, MainCameraStorage mainCameraStorage)
 {
     EntitiesStorage   = entitiesStorage;
     MainCameraStorage = mainCameraStorage;
 }