Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for tweening RenderSettings #18

Open
Danta1st opened this issue May 18, 2015 · 2 comments
Open

Support for tweening RenderSettings #18

Danta1st opened this issue May 18, 2015 · 2 comments
Assignees

Comments

@Danta1st
Copy link

Just a suggestion to support adjusting the various colors, etc. in the RenderSettings class/object.

@Demigiant Demigiant self-assigned this May 18, 2015
@Demigiant
Copy link
Owner

I like it! Added to my todo list

@f0ff886f
Copy link

Just a note, if folks need something like this you can create some helper static methods in a static class, like this:

public static class GlobalHelpers
{
    private static Tween FogStartDistanceTween;
    private static Tween FogEndDistanceTween;
    private static Tween AmbientColorTween;

    // method to change fog settings
    public static void TweenFogDistances(float start, float end, float time, Action completeLambda = null)
    {
        FogStartDistanceTween.Kill();
        FogEndDistanceTween.Kill();

        FogStartDistanceTween = DOTween.To(() => RenderSettings.fogStartDistance, (x) => RenderSettings.fogStartDistance = x, start, time);
        FogEndDistanceTween = DOTween.To(() => RenderSettings.fogEndDistance, (x) => RenderSettings.fogEndDistance = x, end, time);

        FogStartDistanceTween.OnComplete(() => completeLambda?.Invoke());
    }

    // method to change ambient color
    public static Tween TweenAmbientColor(Color color, float time)
    {
        AmbientColorTween.Kill();

        AmbientColorTween = DOTween.To(() => RenderSettings.ambientLight, (x) => RenderSettings.ambientLight = x, color, time);

        return AmbientColorTween;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants