<commit_before>﻿using UnityEngine;
using System.Collections;
using System;

public class FadeTransition : MonoBehaviour {
    private Texture2D Texture = Texture2D.whiteTexture; //super tiny basic texture
    private int DrawDepth = -1000; //forces the texture to be drawn last
    private Color OpaqueColor = Color.black;
    private Color TransparentColor = Color.clear;
    private Color CurrentColor = Color.clear;
    private float Direction; //-1 is fade out, 1 is fade in
    private float CurrentDuration;
    private float Duration;

    //Public variables
    public static bool IsFading = false;
    public const float FadeOut = 1; //fade to black
    public const float FadeIn = -1; //fade to clear


    public static void Fade(float direction, float duration, Color color, Action finishedCallback) {
        Instance.Direction = direction;
        Instance.Duration = duration;

        Instance.OpaqueColor = color;
        Instance.TransparentColor = new Color(color.r, color.g, color.b, 0);

        Instance.StartCoroutine(Instance.StartFade(finishedCallback));
    }

    public static void SetOpaque(bool opaque) {
        Instance.CurrentColor = opaque ? Instance.OpaqueColor : Instance.TransparentColor;
    }<commit_msg>Made the callback optional when calling the fade function.<commit_after>﻿using UnityEngine;
using System.Collections;
using System;

public class FadeTransition : MonoBehaviour {
    private Texture2D Texture = Texture2D.whiteTexture; //super tiny basic texture
    private int DrawDepth = -1000; //forces the texture to be drawn last
    private Color OpaqueColor = Color.black;
    private Color TransparentColor = Color.clear;
    private Color CurrentColor = Color.clear;
    private float Direction; //-1 is fade out, 1 is fade in
    private float CurrentDuration;
    private float Duration;

    //Public variables
    public static bool IsFading = false;
    public const float FadeOut = 1; //fade to black
    public const float FadeIn = -1; //fade to clear


    public static void Fade(float direction, float duration, Color color, Action finishedCallback = null) {
        Instance.Direction = direction;
        Instance.Duration = duration;

        Instance.OpaqueColor = color;
        Instance.TransparentColor = new Color(color.r, color.g, color.b, 0);

        Instance.StartCoroutine(Instance.StartFade(finishedCallback));
    }

    public static void SetOpaque(bool opaque) {
        Instance.CurrentColor = opaque ? Instance.OpaqueColor : Instance.TransparentColor;
    }
{'fraction_non_alphanumeric': 0.07486209613869188, 'fraction_numerical': 0.008668242710795903, 'mean_word_length': 3.3625429553264605, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2436576', 'n_tokens_mistral': 694, 'n_tokens_neox': 661, 'n_words': 237}