public static void SpeedIncrease(ISpeedMod target, float amount)
 {
     target.Speed += amount;
     if (target.Speed > target.SpeedMax)
     {
         target.Speed = target.SpeedMax;
     }
 }
    //ISpeedMod Functions
    //See ISpeedMod.cs

    public static void SpeedDecrease(ISpeedMod target, float amount)
    {
        target.Speed -= amount;
        if (target.Speed < target.SpeedMin)
        {
            target.Speed = target.SpeedMin;
        }
    }
    //OnTriggerEnter2D
    //Handles collision event, checking for a valid collision
    //Only interacts with specified target type. Used IVulnerable and ISpeedMod for effects.
    //Effect depends on chosen Effect enum.
    //Will destroy the missile after impact if destroyOnImpact is true.
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == hitTag)
        {
            //Applies effect based on selected effect type.
            //Note: Incompatable effects (hitting a non-ISpeedMod target with a slow) will still trigger here, but will fail.
            switch (effect)
            {
            case EffectType.None:
                Debug.Log("Hit " + other);
                break;

            case EffectType.Damage:
                IVulnerable damageTarget = other.GetComponent("IVulnerable") as IVulnerable;
                damageTarget.Injure(effectAmount);
                break;

            case EffectType.Slow:
                ISpeedMod speedTarget = other.GetComponent("ISpeedMod") as ISpeedMod;
                speedTarget.SpeedDecrease(effectAmount);
                break;

            default:
                Debug.Log("Effeect not found " + effect);
                break;
            }

            //Destroys the target if set to destroyOnImpact. Otherwise projectile will destroy after missileLifespan.
            if (destroyedOnImpact == true)
            {
                Destroy(gameObject);
                if (deathEmission != null)
                {
                    Instantiate(deathEmission, transform.position, transform.rotation);
                }
            }
        }
    }
 public static void SpeedReset(ISpeedMod target)
 {
     target.Speed = target.SpeedDefault;
 }