Beispiel #1
0
    /// <summary>
    /// Called when this bullet hits an object that has a target attached
    /// </summary>
    /// <param name="_target">_target.</param>
    public virtual void OnTargetCollision( BaseHealth _health, bool _passingThrough )
    {
        if ( _health.Owner == null || _health.Owner.team != this.source.health.Owner.team )
        {
            _health.DealDamage( this.desc.damage * this.damageScale, true, this.source.health.Owner );
        }

        if ( !_passingThrough )
        {
            BulletManager.instance.DestroyLocalBullet( this );
        }
    }
Beispiel #2
0
    private void AreaOfEffectDamageCheck( BaseHealth _health, 
	      Vector3 _position, float _radius, float _damage, bool _friendlyFire,
	      GamePlayer _sourcePlayer )
    {
        if ( _friendlyFire && _sourcePlayer.team == _health.Owner.team )
        {
            return;
        }

        float distance = (_health.transform.position - _position ).magnitude;
        if ( distance < _radius )
        {
            float multiplier = 1.0f - distance / _radius;
            _health.DealDamage( _damage * multiplier, true, _sourcePlayer );
        }
    }