Пример #1
0
        /// <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;
            }
        }
Пример #2
0
 private void Awake()
 {
     if (_ballParameters.Transform == null)
         _ballParameters.Transform = transform;
     
     PlayerBallController = DependencyResolver.GetPlayerBallController(_ballParameters);
     this.Rise(GameManagementEvent.OnBallSpawned());
 }
Пример #3
0
 private void SetUpController()
 {
     _ballParameters.BallTransform = transform; //На всякий случай, если в эдиторе криво настроят
     _playerBallController         = DependencyResolver.GetPlayerBallController(_ballParameters);
 }
Пример #4
0
 /// <summary> Метод для использования в качестве колбэка <see cref="OnBallCollisionMono.OnBallCollision"/> </summary>
 public void OnBallHit(IPlayerBallController ballController)
 {
     _brickController.OnBallHit(ballController);
 }