EnemyBase.Slow C# (CSharp) Method

Slow() public method

Slows the EnemyBase by a percentage.
Percentage is 0-1 not 0-100
public Slow ( float percentage, float duration ) : void
percentage float Percent to slow.
duration float Duration of effect.
return void
    public void Slow(float percentage, float duration)
    {
        IBuff buff = new Slow (this, duration, percentage);
        this.debuffs.Add (buff);
    }

Usage Example

Example #1
0
    void Laser()
    {
        if (targetEnemyBase != null)
        {
            targetEnemyBase.TakeDamage(damageOverTime * Time.deltaTime);
            targetEnemyBase.Slow(slowPercent);
        }

        if (!lineRenderer.enabled)
        {
            lineRenderer.enabled = true;
            impactEffect.Play();
            impactLight.enabled = true;
        }


        lineRenderer.SetPosition(0, firePoint.position);
        lineRenderer.SetPosition(1, target.transform.position);

        Vector3 dir = firePoint.position - target.transform.position;

        impactEffect.transform.position = target.transform.position + dir.normalized;
        impactEffect.transform.rotation = Quaternion.LookRotation(dir);
    }
All Usage Examples Of EnemyBase::Slow