public void Init(HUDController hudController) { _hudController = hudController; PlayerCombatView view = GameObject.Instantiate <PlayerCombatView>(_gameplayResources.playerCombatView); _playerCombatController = new PlayerCombatController(view, _gameConfig.playerConfig); _playerCombatController.AddListener(GameplayEventType.DAMAGE_TAKEN, OnPlayeDamageTake); _gameplayCam = GameObject.FindObjectOfType <GameplayCamera>(); _combatCamera = new CombatCamera(_gameplayCam, _playerCombatController.transform); _parentController = GameObject.Instantiate <ParentController>(_gameplayResources.parentController); _parentController.Init(_gameConfig.playerConfig); _parentController.AddListener(GameplayEventType.DAMAGE_TAKEN, OnParentDamageTaken); }
public PlayerCombatController(PlayerCombatView view, PlayerConfig config) { health = config.startHealth; _view = view; _view.controller = this; _physBody = view._rigidBody; _config = config; _physBody.drag = _config.movement.drag; _moveDirection = Vector3.zero; string[] layerList = { "CombatPlayer" }; _targetMask = ~LayerMask.GetMask(layerList); _dispatcher = Singleton.instance.notificationDispatcher; }