Exemplo n.º 1
0
    public void SourceFound()
    {
        var timeElapsed = swh.ResetAndStartStopWatch();

        TestCase.FoundObject foundObject = new TestCase.FoundObject(enemyInitService.getCurrentEnemy().transform.position, timeElapsed);

        testCases[currentTestCaseIndex].SourceFound(foundObject);


        enemyInitService.initializeRandomAudioSource();
        if (testCases[currentTestCaseIndex].IsFinished())
        {
            if (testCases.Count == currentTestCaseIndex + 1)
            {
                StartCoroutine(ShowMessage("Thank you for participating", 2));
                LoadEndScreen();
            }
            else
            {
                StartCoroutine(ShowMessage("Good job! Start the next Test!", 2));
                setRestrictedMode(false);
                LoadNextTestCase();
            }
        }
    }
Exemplo n.º 2
0
    public void initializeRandomAudioSource(TestCase.FoundObject foundObject = null)
    {
        muteAllEnemies();

        var enemyIndex = r.Next(enemies.Count - 1);

        while (enemyIndex == lastSoundSourceIndex)
        {
            enemyIndex = r.Next(enemies.Count - 1);
        }

        var enemy = enemies[r.Next(enemies.Count - 1)];

        while (foundObject != null && enemy.transform.position == foundObject.getPosition())
        {
            enemy = enemies[r.Next(enemies.Count - 1)];
        }

        lastSoundSourceIndex = enemyIndex;
        enemy.transform.GetComponent <AudioSource>().enabled = true;
    }