Example #1
0
    protected override void OnProjectileHit
        (ProjectileHandler projectile, Collider2D collision)
    {
        if (projectile.IsSameSender(collision.gameObject))
        {
            return;
        }

        BaseController victim = collision.gameObject
                                .GetComponent <BaseController>();

        if (!victim || victim.IsTeammate(projectile.Sender))
        {
            return;
        }

        projectile.Sender.perks.Activate <IProjectileHitTarget>(1,
                                                                perk => perk.OnHit(projectile, victim));

        float damage = Math.Min(projectile.damage,
                                (projectile.Rigidbody.velocity.magnitude
                                 + victim.body.Body.velocity.magnitude));

        victim.ProcessDamage(damage, projectile.Sender,
                             projectile.transform.position);

        float push = (damage * projectile.force) / 8;

        victim.ApplyCollisionForce(projectile.transform.position, push / 2, push);
    }
Example #2
0
    protected override void OnProjectileHit(ProjectileHandler projectile, Collider2D collision)
    {
        if (projectile.IsSameSender(collision.gameObject))
        {
            return;
        }

        BaseController controller = collision.gameObject
                                    .GetComponent <BaseController>();

        if (controller)
        {
            controller.ProjectileHit(projectile);
        }
    }