示例#1
0
    public override void ReceiveHit(float damage, GameObject attackerObject, GameObject attack)
    {
        IAttacker attacker = ResolveAttacker(attackerObject);
        bool      deferHit = false;

        deferHit = HandledByShield();
        if (!deferHit)
        {
            deferHit = HandledByCharging(attack);
        }

        if (!deferHit)
        {
            Player attackingPlayer = attack.GetComponent <Player>();
            if (attackingPlayer && attackingPlayer.vehicleControls.IsCharging())
            {
                if (currentStunDuration < maxStunDuration)
                {
                    damage = 0;
                }
                else
                {
                    Stun();
                }
            }
            if (!playerHitState.isHit)
            {
                if (attacker != null)
                {
                    attacker.RegisterSuccessfulAttack(5);
                }
            }

            playerHitState.RegisterHit();
            if (playerHitState.IsCritical())
            {
                damageBehavior.ReceiveDamage(damage * 2);
            }
            else
            {
                damageBehavior.ReceiveDamage(damage);
            }

            if (damageBehavior.CurrentHealthRatio() <= 0)
            {
                DestroyMe();
                if (attacker != null)
                {
                    attacker.RegisterSuccessfulDestroy(15);
                }
            }
        }
    }
示例#2
0
    public override void ReceiveHit(float damage, GameObject attackerObject, GameObject attack)
    {
        IAttacker attacker = ResolveAttacker(attackerObject);

        if (attacker != null)
        {
            attacker.RegisterSuccessfulAttack(0);
        }
        damageBehavior.ReceiveDamage(damage);

        if (damageBehavior.CurrentHealthRatio() <= 0)
        {
            DestroyMe();
        }
    }
示例#3
0
    public override void ReceiveHit(float damage, GameObject attackerObject, GameObject attack)
    {
        IAttacker attacker = ResolveAttacker(attackerObject);

        if (attackerObject && attackerObject.GetComponent <Minion>())
        {
            damage /= 2;
        }
        if (attacker != null)
        {
            attacker.RegisterSuccessfulAttack(0);
        }
        damageBehavior.ReceiveDamage(damage);
        if (damageBehavior.CurrentHealthRatio() <= 0)
        {
            if (attacker != null)
            {
                attacker.RegisterSuccessfulDestroy(5);
            }
            DestroyMe(attack);
        }
    }