示例#1
0
    public void SetEffect(string effect, float intensity = -1)
    {
        if (effect == null)
        {
            throw new CYFException("Text.SetEffect: The first argument (the effect name) is nil.\n\nSee the documentation for proper usage.");
        }
        CheckExists();
        switch (effect.ToLower())
        {
        case "none":
            textEffect = null;
            break;

        case "twitch":
            if (intensity != -1)
            {
                textEffect = new TwitchEffect(this, intensity);
            }
            else
            {
                textEffect = new TwitchEffect(this);
            }
            break;

        case "shake":
            if (intensity != -1)
            {
                textEffect = new ShakeEffect(this, intensity);
            }
            else
            {
                textEffect = new ShakeEffect(this);
            }
            break;

        case "rotate":
            if (intensity != -1)
            {
                textEffect = new RotatingEffect(this, intensity);
            }
            else
            {
                textEffect = new RotatingEffect(this);
            }
            break;

        default:
            throw new CYFException("The effect \"" + effect + "\" doesn't exist.\nYou can only choose between \"none\", \"twitch\", \"shake\" and \"rotate\".");
        }
    }
示例#2
0
    public void SetEffect(string effect, float intensity)
    {
        switch (effect.ToLower())
        {
        case "none":
            textEffect = null;
            break;

        case "twitch":
            if (intensity != -1)
            {
                textEffect = new TwitchEffect(this, intensity);
            }
            else
            {
                textEffect = new TwitchEffect(this);
            }
            break;

        case "shake":
            if (intensity != -1)
            {
                textEffect = new ShakeEffect(this, intensity);
            }
            else
            {
                textEffect = new ShakeEffect(this);
            }
            break;

        case "rotate":
            if (intensity != -1)
            {
                textEffect = new RotatingEffect(this, intensity);
            }
            else
            {
                textEffect = new RotatingEffect(this);
            }
            break;

        default:
            throw new CYFException("The effect \"" + effect + "\" doesn't exist.\nYou can only choose between \"none\", \"twitch\", \"shake\" and \"rotate\".");
        }
    }