Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (_mainGame.IsGameEnd)
        {
            return;
        }

        int secondLeft = Mathf.RoundToInt(levelSeconds - Time.timeSinceLevelLoad);

        _text.text = secondLeft.ToString();

        bool timeIsUp = (0 >= secondLeft);

        if (timeIsUp && !_isEndOfLevel)
        {
            _isEndOfLevel       = true;
            _mainGame.IsGameEnd = true;
            _mainGame.TriggerLoseCondition();
            _warningMsg.ActivateMsgWithText("Time is up!");

            //_audioSource.Play ();
            Invoke("ReloadLevel", 3.0f /*_audioSource.clip.length*/);
            //_labelWin.SetActive(true);
        }
    }
Beispiel #2
0
    public void StartWarning()
    {
        if (!_IsOnWarning)
        {
            _fadeInDueTime = Time.timeSinceLevelLoad + FadeInDuration;
            _IsOnWarning   = true;

            _warningMsg.ActivateMsgWithText("Enemy is too close to her!");
        }
    }