Пример #1
0
        private void OnCollisionEnter(Collision other)
        {
            var barrier = other.transform.GetComponent <BarrierCoefficient>();

            if (barrier != null)
            {
                if (other.GetHashCode() == _lastCollisionObject)
                {
                    return;
                }
                var points = BaseScore * barrier.GetCoefficient();
                _lastCollisionObject = other.GetHashCode();
                _enemy.AddPoint((int)points);
            }
        }
Пример #2
0
        private void OnCollisionEnter(Collision other)
        {
            var barrier = other.transform.GetComponent <BarrierCoefficient>();

            if (barrier != null)
            {
                if (other.GetHashCode() == _lastCollisionObject)
                {
                    return;
                }
                var points = BaseScore * barrier.GetCoefficient();
                var damage = _baseDamage * barrier.GetDamageCoefficient();
                _lastCollisionObject = other.GetHashCode();
                _enemy.AddPoint((int)points);
                _enemy.HealthDecrease((int)damage);
                OnScoreChanged?.Invoke(gameObject.transform.position, _enemy.Score.ToString(), Color.red);
            }
        }