示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (playerBar.GetValue() <= (maxLife / factor) && count < occurrences && go)
     {
         Instantiate(healthkit, new Vector2(player.position.x, 8.15f), Quaternion.identity);
         count++;
         factor++;
         StartCoroutine(Wait());
     }
 }
示例#2
0
    private IEnumerator CheckIfWin()
    {
        if (playerBar.GetValue() <= 0 && !alreadyPlayed)
        {
            if (!bitchSound.isPlaying && !laughSound.isPlaying)
            {
                yield return(new WaitForSeconds(1.5f));

                bitchSound.Play();
                alreadyPlayed = true;
            }
        }
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        timeSpent += Time.deltaTime;               // time spent in seconds

        if (bossBar.GetValue() <= 0 && !gameEnded) //level completed
        {
            gameEnded = true;
            Win();
        }

        int min = Mathf.FloorToInt(timeSpent / 60);
        int sec = Mathf.FloorToInt(timeSpent % 60);

        timerUI.text = min.ToString("00") + ":" + sec.ToString("00");
    }