/// <inheritdoc/> public void OnBallHit(IPlayerBallController ballController) { if (IsDead()) { return; } var currentLiveHint = _brickParameters.Lives[_currentLiveId].hitScore; var brickHintEventParams = new BrickWasHitEventParams(currentLiveHint); _messageDispatcher.Rise(this, brickHintEventParams); _currentLiveId++; if (IsDead()) { var deathScore = _brickParameters.BrickLiveScore; var brickPosition = _brickParameters.BrickTransform.position; var brickDeathsEventParams = new BrickWasDestroyedEventParams(deathScore, brickPosition); var effectPosition = _brickParameters.BrickTransform.position; var effectRotation = _brickParameters.BrickTransform.rotation; _effectPool.AddEffectRequest(_brickParameters.DeathEffect, effectPosition, effectRotation); _messageDispatcher.Rise(this, brickDeathsEventParams); Object.Destroy(_brickParameters.BrickTransform.gameObject); } else { var currentLive = _brickParameters.Lives[_currentLiveId]; _brickParameters.BrickSpriteHolder.sprite = currentLive.LiveSprite; } }
private void Awake() { if (_ballParameters.Transform == null) _ballParameters.Transform = transform; PlayerBallController = DependencyResolver.GetPlayerBallController(_ballParameters); this.Rise(GameManagementEvent.OnBallSpawned()); }
private void SetUpController() { _ballParameters.BallTransform = transform; //На всякий случай, если в эдиторе криво настроят _playerBallController = DependencyResolver.GetPlayerBallController(_ballParameters); }
/// <summary> Метод для использования в качестве колбэка <see cref="OnBallCollisionMono.OnBallCollision"/> </summary> public void OnBallHit(IPlayerBallController ballController) { _brickController.OnBallHit(ballController); }