Exemple #1
0
 private void Awake()
 {
     if (!instance)
     {
         instance = this;
     }
 }
Exemple #2
0
    private IEnumerator UpdateAudioCapture()
    {
        yield return(new WaitForSeconds(waitUntilStart));

        running = true;
        StartCoroutine("StartScratching");
        SoundManager.Instance.heartBeat.heartRateQuickener = 3f;

        while (running)
        {
            // player holds breadth for 5 seconds
            if (AudioPlayBack.GetInstance().GetComponent <AudioAnalyze>().GetAvgSound() > noiseThreshold || eventOcurred)
            {
                eventOcurred  = false;
                keepQuietTime = 0f;
                timeThatThePlayerIsBeingNoisy += Time.deltaTime;

                if (timeThatThePlayerIsBeingNoisy >= 3f)
                {
                    if (!isGrowling)
                    {
                        StartCoroutine("StartGrowling");
                    }
                    dogIsNowGrowling += Time.deltaTime;
                    //if(dogIsNowGrowling > 5f) Detected();
                }

                if (angryTime > 0f)
                {
                    angryTime = totalAngryTime;
                    gameTime  = totalGameTime;
                }
                else
                {
                    if (!isAngry)
                    {
                        OnPlayerHidden();
                    }
                    gameTime = totalGameTime;
                }
            }
            else
            {
                keepQuietTime += Time.deltaTime;
                if (isGrowling)
                {
                    dogIsNowGrowling += Time.deltaTime;
                    //if(dogIsNowGrowling > 5f) Detected();
                }
                timeThatThePlayerIsBeingNoisy = 0f;
                if (keepQuietTime > 4f)
                {
                    EndMinigame();
                }
            }
            yield return(null);
        }
    }
        //--------------------------------------------------------------------------------------------------------
        //------------------------- </RECORD MICROPHONE> ---------------------------------------------------------
        //--------------------------------------------------------------------------------------------------------
        #endregion


        private void CloseWindow()
        {
            timer.Stop();
            Dispose();
            AudioPlayBack.Dispose();
            visualizations = null;
            SelectedDevice = null;
            AudioPlayBack  = null;

            Environment.Exit(0);
        }
 private void Awake()
 {
     if(!instance)
         instance = this;
 }