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

public class FadingMusic : MonoBehaviour
{

#pragma warning disable 0649
    [SerializeField]
    private float fadeSpeed;
#pragma warning restore 0649

    private AudioSource _audioSource;
    private bool started;

	void Awake()
	{
        started = false;
        _audioSource = GetComponent<AudioSource>();
	}

    void Update()
    {
        if (started)
            updateFade();
    }

	
	void updateFade()
	{
        float diff = fadeSpeed * Time.deltaTime;
        if (_audioSource.volume <= diff)
        {
            _audioSource.volume = 0f;
            _audioSource.Stop();
        }
        else
            _audioSource.volume -= diff;
	}

    public void startFade()
    {
        started = true;
    }
}<commit_msg>Add fade-in feature to FadingMusic<commit_after>﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FadingMusic : MonoBehaviour
{

#pragma warning disable 0649
    [SerializeField]
    private bool fadeInFirst;
    [SerializeField]
    private float fadeSpeed;
#pragma warning restore 0649

    private AudioSource _audioSource;
    private bool started;

	void Awake()
	{
        started = false;
        _audioSource = GetComponent<AudioSource>();
	}

    void Update()
    {
        if (started)
            updateFade();
    }

	
	void updateFade()
	{
        float diff = fadeSpeed * Time.deltaTime;
        if (fadeInFirst)
        {
            if (_audioSource.volume >= diff)
            {
                _audioSource.volume = 1f;
                fadeInFirst = started = false;
            }
            else
                _audioSource.volume += diff;
        }
        else
        {
            if (_audioSource.volume <= diff)
            {
                _audioSource.volume = 0f;
                _audioSource.Stop();
            }
            else
                _audioSource.volume -= diff;
        }
	}

    public void startFade()
    {
        if (started && fadeInFirst)
            fadeInFirst = false;
        started = true;
    }
}
{'fraction_non_alphanumeric': 0.08399812294697326, 'fraction_numerical': 0.008916001877053027, 'mean_word_length': 1.7652399481193255, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, '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': '229146', 'n_tokens_mistral': 620, 'n_tokens_neox': 584, 'n_words': 145}