Beispiel #1
0
    IEnumerator EffectsEngine()
    {
        foreach (ScriptEffects effect in effects)
        {
            switch (effect.effectType)
            {
            case EffectTypes.SPLATTER:
                if (effect.imageScale == 0)
                {
                    splatterScript.Activate(effect.effectTime, effect.fadeInTime, effect.fadeOutTime);
                }
                else if (effect.imageScale != 0)
                {
                    splatterScript.Activate(effect.effectTime, effect.fadeInTime, effect.fadeOutTime, effect.imageScale);
                }
                else
                {
                    splatterScript.Activate();
                }
                yield return(new WaitForSeconds(effect.effectTime));

                break;

            case EffectTypes.SHAKE:
                if (effect.magnitude != 0)
                {
                    cameraShakeScript.Activate(effect.effectTime, effect.magnitude);
                }
                else
                {
                    cameraShakeScript.Activate();
                }
                yield return(new WaitForSeconds(effect.effectTime));

                break;

            case EffectTypes.FADE:
                fadeScript.Activate(effect.effectTime, effect.fadeInTime, effect.fadeOutTime);
                yield return(new WaitForSeconds(effect.effectTime));

                break;

            case EffectTypes.WAIT:
                yield return(new WaitForSeconds(effect.effectTime));

                break;

            default:
                break;
            }
        }
    }