示例#1
0
    private void ApplyEffects(GameObject player)
    {
        if (healing)
        {
            origin.GetComponent <Health>().Heal(healingAmount);
        }

        if (poison)
        {
            if (currentDot)
            {
                currentDot.Reapply();
            }
            else
            {
                currentDot = player.AddComponent <DotDamage>();
                currentDot.SetInitial(null, Random.Range(3f, 5f));
                currentDot.SetStats(1, damageMultiplier, 1f);
            }
        }

        if (slowing)
        {
            SlowingEffect newDebuff = player.AddComponent <SlowingEffect>();
            newDebuff.SetInitial(null, Random.Range(1f, 2f));
            newDebuff.SetStats(Random.Range(0f, 0.3f));
        }
    }
    private void AddDotDamage()
    {
        if (player.TryGetComponent(out DotDamage _))
        {
            foreach (DotDamage dotdamage in player.GetComponents <DotDamage>())
            {
                Destroy(dotdamage);
            }
        }
        DotDamage newDot = player.AddComponent <DotDamage>();

        newDot.SetInitial(vfx, stats.dotLifetime);
        newDot.SetStats(stats.damage, damageMultiplier, stats.damageCooldown);
    }
    private const float forever = 1000000; // Pseudo-eternity

    protected override void EnterEffect()
    {
        player.GetComponent <Health>().TakeDamage(damage);

        if (current)
        {
            current.Reapply();
        }
        else
        {
            current = player.AddComponent <DotDamage>();
            current.SetInitial(fireVFX, forever);
            current.SetStats(damage, difficultyMultiplier, cooldown);
        }
    }
    public void Attack()
    {
        if (player == null)
        {
            player = boss.player.GetComponent <Player>();
            DotDamage newDebuff = player.gameObject.AddComponent <DotDamage>();
            newDebuff.SetInitial(null, forever);
            newDebuff.SetStats(damagePerTick, 1, timeBetweenTicks);
            return;
        }

        boss.SetDirection((player.transform.position - transform.position).normalized);
        boss.keepDirection   = true;
        boss.speedMultiplier = chargeSpeedMultiplier;

        chargeTimer = chargeCooldown;
    }