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

public class MakeItRain : MonoBehaviour
{
    private int numObjects;
    private float minX = -4f;
    private float maxX = 4f;
    private GameObject rain;
    private GameObject rainClone;
    private int danceQuality; // 0 is worst, 3 is best
    float startTimer = 31;
    float timer;
    int level = 0;
    public Text timerText;
    public Text scoreText;

    // Use this for initialization
    void Start()
    {
        UpdateScore();
        InitializeTimer();
        danceQuality = -1;
    }

    void Update()
    {
        UpdateTime();
    }

    // Controls Timer
    void UpdateTime()
    {
        timer -= Time.deltaTime;
        if (timer > 0)
        {
            timerText.text = "TIMER : " + ((int) timer).ToString();
        }
        else {
            if (startTimer <= 0)
            {
                UnityEngine.SceneManagement.SceneManager.LoadScene("GameOver");
            }

            timerText.text = "TIMER : 0";
            timer = 0;
            danceQuality = 0;
            Rain();
        }
    }
    
    void UpdateScore()
    {
            scoreText.text = "SCORE : " + ScoreManager.score.ToString();
    }

    // Rain also calls this
    void InitializeTimer()
    {
        timer = startTimer - level;
        UpdateTime();
    }
    
    // Called only when dance is finished or time is out
    public void Rain()
    {
        // Debug.Log(danceQuality);
     // figure out danceQuality depending on how much time timer has left
        if (danceQuality != 0)
        {
            danceQuality = (int) Mathf.Ceil(timer*3/ startTimer);
            ScoreManager.score = ScoreManager.score + level + (int) timer;
            UpdateScore();
            level++;
        }

        GameObject[] rainArray;

        switch (danceQuality)
        {
            case 1:
                rainArray = GameObject.FindGameObjectsWithTag("Poor");
                break;
            case 2:
                rainArray = GameObject.FindGameObjectsWithTag("Fair");
                break;
            case 3: 
                rainArray = GameObject.FindGameObjectsWithTag("Good");
                break;
             default:
                rainArray = GameObject.FindGameObjectsWithTag("Bad");
                break;
        }

        // pick an object
        int randomNumber = Random.Range(0, rainArray.Length - 1);
        GameObject rain = rainArray[randomNumber];

        // determine numObjects using object size!
        float width = rain.GetComponent<BoxCollider2D>().size.x;
        float damage = (float) rain.GetComponent<RainWatcher>().getDamage();
        numObjects = (int)Mathf.Ceil(20.0f / damage);
        if (width <= 0.5)
            numObjects = numObjects * 2;
        if (danceQuality == 3)
            numObjects = 5;
        else if (danceQuality == 2)
            numObjects = (int)Mathf.Ceil(6.0f / width);
        for (int i = 0; i < numObjects; i++)
        {
            float x_rand = Random.Range(minX, maxX - width);
            float y_rand = Random.Range(1f, 3f);
            rainClone = (GameObject) Instantiate(rain, new Vector3(x_rand, rain.transform.position.y - y_rand, rain.transform.position.z), rain.transform.rotation);
            rainClone.GetComponent<Rigidbody2D>().gravityScale = 1;
            rainClone.GetComponent<RainWatcher>();
            rainClone.tag = "Untagged";
            Collider2D rainCol = rainClone.GetComponent<BoxCollider2D>();
            Collider2D leftWall = GameObject.Find("LeftWall").GetComponent<BoxCollider2D>();
            Collider2D rightWall = GameObject.Find("RightWall").GetComponent<BoxCollider2D>();
            Physics2D.IgnoreCollision(rainCol, leftWall, true);
            Physics2D.IgnoreCollision(rainCol, rightWall, true);
        }

        // Restart
        danceQuality = -1;
        InitializeTimer();
        Debug.Log(timer);
    }
}<commit_msg>Tweaked more values<commit_after>﻿using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class MakeItRain : MonoBehaviour
{
    private int numObjects;
    private float minX = -4f;
    private float maxX = 4f;
    private GameObject rain;
    private GameObject rainClone;
    private int danceQuality; // 0 is worst, 3 is best
    float startTimer = 31;
    float timer;
    int level = 0;
    public Text timerText;
    public Text scoreText;

    // Use this for initialization
    void Start()
    {
        UpdateScore();
        InitializeTimer();
        danceQuality = -1;
    }

    void Update()
    {
        UpdateTime();
    }

    // Controls Timer
    void UpdateTime()
    {
        timer -= Time.deltaTime;
        if (timer > 0)
        {
            timerText.text = "TIMER : " + ((int) timer).ToString();
        }
        else {
            if (startTimer <= 0)
            {
                UnityEngine.SceneManagement.SceneManager.LoadScene("GameOver");
            }

            timerText.text = "TIMER : 0";
            timer = 0;
            danceQuality = 0;
            Rain();
        }
    }
    
    void UpdateScore()
    {
            scoreText.text = "SCORE : " + ScoreManager.score.ToString();
    }

    // Rain also calls this
    void InitializeTimer()
    {
        timer = startTimer - level;
        UpdateTime();
    }
    
    // Called only when dance is finished or time is out
    public void Rain()
    {
        // Debug.Log(danceQuality);
     // figure out danceQuality depending on how much time timer has left
        if (danceQuality != 0)
        {
            danceQuality = (int) Mathf.Ceil(timer*3/(startTimer - level));
            ScoreManager.score = ScoreManager.score + level + (int) timer;
            UpdateScore();
            level++;
        }

        GameObject[] rainArray;

        switch (danceQuality)
        {
            case 1:
                rainArray = GameObject.FindGameObjectsWithTag("Poor");
                break;
            case 2:
                rainArray = GameObject.FindGameObjectsWithTag("Fair");
                break;
            case 3: 
                rainArray = GameObject.FindGameObjectsWithTag("Good");
                break;
             default:
                rainArray = GameObject.FindGameObjectsWithTag("Bad");
                break;
        }

        // pick an object
        int randomNumber = Random.Range(0, rainArray.Length - 1);
        GameObject rain = rainArray[randomNumber];

        // determine numObjects using object size!
        float width = rain.GetComponent<BoxCollider2D>().size.x;
        float damage = (float) rain.GetComponent<RainWatcher>().getDamage();
        numObjects = (int)Mathf.Ceil(25.0f / damage);
        if (width <= 0.5)
            numObjects = numObjects * 2;
        if (danceQuality == 3)
            numObjects = 10;
        else if (danceQuality == 2)
            numObjects = (int)Mathf.Ceil(6.0f / width);
        for (int i = 0; i < numObjects; i++)
        {
            float x_rand = Random.Range(minX, maxX - width);
            float y_rand = Random.Range(1f, 3f);
            rainClone = (GameObject) Instantiate(rain, new Vector3(x_rand, rain.transform.position.y - y_rand, rain.transform.position.z), rain.transform.rotation);
            rainClone.GetComponent<Rigidbody2D>().gravityScale = 1;
            rainClone.GetComponent<RainWatcher>();
            rainClone.tag = "Untagged";
            Collider2D rainCol = rainClone.GetComponent<BoxCollider2D>();
            Collider2D leftWall = GameObject.Find("LeftWall").GetComponent<BoxCollider2D>();
            Collider2D rightWall = GameObject.Find("RightWall").GetComponent<BoxCollider2D>();
            Physics2D.IgnoreCollision(rainCol, leftWall, true);
            Physics2D.IgnoreCollision(rainCol, rightWall, true);
        }

        // Restart
        danceQuality = -1;
        InitializeTimer();
        Debug.Log(timer);
    }
}
{'fraction_non_alphanumeric': 0.10503144654088051, 'fraction_numerical': 0.011949685534591196, 'mean_word_length': 1.8105337575114882, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 19, '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': '2200675', 'n_tokens_mistral': 2326, 'n_tokens_neox': 2203, 'n_words': 522}