Beispiel #1
0
    override public void SetTarget(Targetable target)
    {
        if (!target)
        {
            Debug.Log($"Spell {name} has no target. Target probably has been destroyed.");

            return;
        }

        base.SetTarget(target);

        HP hp = target.GetComponent <HP>( );

        hp.DoDamage(effectAmount, transform.position, targetFreezTime > 0);

        if (targetShockTime > 0 || targetFreezTime > 0)
        {
            Unit unit = target.GetComponent <Unit>( );
            unit.Freez(targetShockTime, targetFreezTime);

            UnitVisuals unitVis = target.GetComponent <UnitVisuals>( );
            unitVis.Shocked(targetShockTime);
        }

        if (shakeStrength > 0)
        {
            ScreenshakeManager.Instance.DoShake(shakeStrength);
        }
    }
    private void DoDamage( )
    {
        if (burnTimeRemaining >= 0)
        {
            hp?.DoDamage(damage, transform.position);
            Invoke(nameof(DoDamage), damageTick);
        }
        else
        {
            isBurning = false;

            if (particles)
            {
                var emission = particles.emission;
                emission.rateOverTime = 0;
            }
        }
    }
Beispiel #3
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "Enemy" || other.gameObject.tag == "Player")
        {
            HP    hp              = other.GetComponent <HP>();
            Unit  unit            = other.GetComponent <Unit>();
            float damageToInflict = damage;
            if (other.gameObject.name == "Enemy Wall" && projectileType == ProjecttileType.Siege)
            {
                damageToInflict *= siegeDamageMultiplier;
            }
            hp.DoDamage(damageToInflict, unit ? unit.Center : transform.position);
        }

        if (other.gameObject.tag == "Enemy" || other.gameObject.tag == "ProjectileShredder" || other.gameObject.tag == "Player")
        {
            Destroy(gameObject);
        }
    }