Exemplo n.º 1
0
    void DoCounting()
    {
        if (countUp)
        {
            timer += Time.deltaTime;
        }
        else
        {
            timer -= Time.deltaTime;
        }

        minutes = Mathf.FloorToInt(timer / 60F);
        seconds = Mathf.FloorToInt(timer - minutes * 60);

        if (seconds != oldSeconds)
        {
            tickSound.Play();
            oldSeconds = seconds;
        }

        correctTime        = string.Format("{0:00}:{1:00}", minutes, seconds);
        countdownText.text = "<mspace=6>" + correctTime + "</mspace>";

        if (timer <= 1.0f || timer > timerDiff + 1)
        {
            isPaused = true;
            coachWhistle.Play();
            if (SceneManager.GetActiveScene().name.Equals("VerktoySortering"))
            {
                displayText.OverwriteText(jsonInfo.GetSceneInfo("toolSorter3"));
                logic.GetComponent <CheckValidTools>().enabled = false;
            }
            commonLogic.WaitChangeScene(5.0f, "TheHub");
        }
    }
Exemplo n.º 2
0
 public void UserGuess(bool choice)
 {
     if (waitingForAnswer)
     {
         if (choice == bool.Parse(informationText[step + 1]))
         {
             UpdateScore(5);
             sounds[0].Play();
         }
         else
         {
             sounds[1].Play();
         }
         teksten.OverwriteText(informationText.ElementAt(step + 2));
         waitingForAnswer = false;
     }
 }
Exemplo n.º 3
0
    public void CheckClosedObjects()
    {
        //  Fullfører gjeldende "step"
        int closedObjects = 0;

        foreach (Transform child in validators.transform)
        {
            if (child.GetComponent <CheckIfClosed>().GetClosedStatus())
            {
                closedObjects++;
            }
        }
        UpdateScoreAndInfo((int)Mathf.Ceil((closedObjects * 30) / openObjects));

        //  Gjør klart til neste "step"
        Instantiate(inConGrab);
        airconditionInfo.GetComponent <DisplayText>().textObject.transform.parent.gameObject.SetActive(true);
        airconditionInfo.OverwriteText(generateJsonInfo.GetSceneInfo("insideVentilationRules"));
    }
Exemplo n.º 4
0
    void UpdateScoreAndInfo(int newScore)
    {
        progressSound.Play();

        segmentScores.Add(newScore);
        score.OverwriteText(segmentScores.Sum().ToString());

        text.OverwriteText(string.Format(informationText.ElementAt(step), segmentScores.Sum(), 123));

        step++;
    }