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


public class MixWetIngredientsMinigame : MonoBehaviour {

    [Header("Minigame parameters")]
    public float timeBeforePointingHand = 1f;
    public int cracksNeeded = 1;
    public float crackForceThreshold = 0f;
    public int eggsNeeded = 2;
    public float milkNeeded = 10f;
    public float milkError = 0.5f;

    public Sprite[] eggSprites;


    [Space(25)]
    [Header("External references")]
    public PointerControl pointer;
    public Transform eggsTarget;
    public Transform bowlBorderTarget;
    public Transform hoverMarkTarget;
    public GameObject hands;
    public Animator[] handsAnimators;
    public GameObject crackedEgg;
    public EggDrag[] eggs;
    public GameObject milk;
    public JugControl jug;
    public PromptControl promptControl;
    public GameObject[] promptContents;


    //[HideInInspector]
    public float milkPoured = 0f;
    public float particleRate = 0f;
    public int particlesPoured = 0;
    private Vector2 eggPosition;
    private bool draggingPhase = true;
    private int cracks = 0;
    private bool blockCalls = false;
    private bool calledOnce = false;
    private int eggsOpened = 0;
    public int lParticles;
    public int particles;


    private bool done = false;


    private void Start() {
        // Disable all egg colliders
        for (int i = 0; i < eggs.Length; i++) {
            eggs[i].gameObject.GetComponent<BoxCollider2D>().enabled = false;
        }
<<<<<<< HEAD

        // Set prompt content and show it
=======
        AkSoundEngine.SetRTPCValue("MiniGame1Finish", 60f, GameObject.FindGameObjectWithTag("MainCamera"), 500);
>>>>>>> db1f200bc7a98197a0b1c2006245bd8b10444ccc
        promptControl.content = promptContents[0];
        promptContents[0].SetActive(true);
        promptControl.ShowPromptAfter(1, 3, StartMinigame, true);
        AkSoundEngine.PostEvent("EggPrompt", gameObject);
    }

    // When the prompt finishes, enable the first egg collider
    public void StartMinigame() {
        FindObjectOfType<InputManager>().SetMultitouch(true);
        eggPosition = eggsTarget.position;
        SetPointer(eggPosition);
        eggs[0].gameObject.GetComponent<BoxCollider2D>().enabled = true;
    }


    private void Update() {

        // Calculate milk poured and check if its more or less than needed
        particles = particlesPoured - lParticles;
        lParticles = particlesPoured;
        particleRate = particles / Time.deltaTime;
        if (particleRate > 0) {
            milkPoured = particlesPoured / particleRate;
        }
        float yscale = Mathf.Min(jug.milkMask.localScale.y + 0.0025f * particles, jug.finalScale);
        jug.milkMask.localScale = new Vector2(1f, yscale);
        //Debug.Log(milkPoured);
        //Alters pitch of water pouring sound with milkPoured Float - may need to use different tag
        AkSoundEngine.SetRTPCValue("Milk_Capacity", milkPoured, GameObject.FindGameObjectWithTag("MainCamera"), 0);
        if (!done && milkPoured > milkNeeded - milkError && milkPoured < milkNeeded + milkError) {<commit_msg>Hotfix for last merge<commit_after>﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class MixWetIngredientsMinigame : MonoBehaviour {

    [Header("Minigame parameters")]
    public float timeBeforePointingHand = 1f;
    public int cracksNeeded = 1;
    public float crackForceThreshold = 0f;
    public int eggsNeeded = 2;
    public float milkNeeded = 10f;
    public float milkError = 0.5f;

    public Sprite[] eggSprites;


    [Space(25)]
    [Header("External references")]
    public PointerControl pointer;
    public Transform eggsTarget;
    public Transform bowlBorderTarget;
    public Transform hoverMarkTarget;
    public GameObject hands;
    public Animator[] handsAnimators;
    public GameObject crackedEgg;
    public EggDrag[] eggs;
    public GameObject milk;
    public JugControl jug;
    public PromptControl promptControl;
    public GameObject[] promptContents;


    //[HideInInspector]
    public float milkPoured = 0f;
    public float particleRate = 0f;
    public int particlesPoured = 0;
    private Vector2 eggPosition;
    private bool draggingPhase = true;
    private int cracks = 0;
    private bool blockCalls = false;
    private bool calledOnce = false;
    private int eggsOpened = 0;
    public int lParticles;
    public int particles;


    private bool done = false;


    private void Start() {
        // Disable all egg colliders
        for (int i = 0; i < eggs.Length; i++) {
            eggs[i].gameObject.GetComponent<BoxCollider2D>().enabled = false;
        }
        // Set prompt content and show it
        AkSoundEngine.SetRTPCValue("MiniGame1Finish", 60f, GameObject.FindGameObjectWithTag("MainCamera"), 500);
        promptControl.content = promptContents[0];
        promptContents[0].SetActive(true);
        promptControl.ShowPromptAfter(1, 3, StartMinigame, true);
        AkSoundEngine.PostEvent("EggPrompt", gameObject);
    }

    // When the prompt finishes, enable the first egg collider
    public void StartMinigame() {
        FindObjectOfType<InputManager>().SetMultitouch(true);
        eggPosition = eggsTarget.position;
        SetPointer(eggPosition);
        eggs[0].gameObject.GetComponent<BoxCollider2D>().enabled = true;
    }


    private void Update() {

        // Calculate milk poured and check if its more or less than needed
        particles = particlesPoured - lParticles;
        lParticles = particlesPoured;
        particleRate = particles / Time.deltaTime;
        if (particleRate > 0) {
            milkPoured = particlesPoured / particleRate;
        }
        float yscale = Mathf.Min(jug.milkMask.localScale.y + 0.0025f * particles, jug.finalScale);
        jug.milkMask.localScale = new Vector2(1f, yscale);
        //Debug.Log(milkPoured);
        //Alters pitch of water pouring sound with milkPoured Float - may need to use different tag
        AkSoundEngine.SetRTPCValue("Milk_Capacity", milkPoured, GameObject.FindGameObjectWithTag("MainCamera"), 0);
        if (!done && milkPoured > milkNeeded - milkError && milkPoured < milkNeeded + milkError) {
{'fraction_non_alphanumeric': 0.0879592810561476, 'fraction_numerical': 0.01638301256561158, 'mean_word_length': 3.136842105263158, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '2651259', 'n_tokens_mistral': 1871, 'n_tokens_neox': 1751, 'n_words': 497}