コード例 #1
0
    protected override void onHit(GameObject g)
    {
        hitList.Add(g);
        UnitStats targetStats     = g.GetComponent <UnitStats>();
        float     increasedDamage = damage + damage * (1 - targetStats.PercentageHealth()); //deal increased damage equal to percentage missing health

        if (slowMulti > 1 && targetStats.isSlowed())
        {
            increasedDamage *= slowMulti;
        }
        targetStats.TakeDamage(increasedDamage);
        if (targetStats.CurrentHealth() <= 0)
        {
            owner.GetComponent <UnitStats>().GainArmor(armorOnKillAmount);
            owner.GetComponent <UnitStats>().Heal(healOnKillAmount);
        }
        if (bleed > 0)
        {
            targetStats.Bleed(bleed);
        }
        if (slow > 0)
        {
            targetStats.Slow(slow);
        }
        if (bleedConsumeMultiplier > 0)
        {
            targetStats.ConsumeBleed(bleedConsumeMultiplier);
        }
        WeaponCollisionEnterEvent.Invoke(g);
        OnHitEvent.Invoke();
        OnHitHeal.Invoke(heal);
    }
コード例 #2
0
    public void BleedTarget(GameObject g, int amount)
    {
        UnitStats u = g.GetComponent <UnitStats>();

        u.Bleed(amount);
    }