Exemple #1
0
    private void FixedUpdate()
    {
        if (!isPaused)
        {
            timer -= Time.deltaTime;
            timerDisplay.GetComponent <TextMeshProUGUI>().text = string.Format("{0:#.00}s", timer);

            if (timer <= 0)
            {
                onLevelFail();
            }

            timeBar.SetTime(timer);
        }

        //For when level is loading
        if (asyncOpertaion != null)
        {
            if (asyncOpertaion.progress >= 0.89)
            {
                winMenu.transform.GetChild(6).gameObject.SetActive(true);
                Invoke("removeLoading", 2.0f);
            }
            else
            {
            }
        }
    }
    void FixedUpdate()
    {
        if (gm.gameState != GameManager.GameState.GAME &
            gm.gameState != GameManager.GameState.RESUME)
        {
            rb.gravityScale = 0.0f;
            rb.velocity     = Vector2.up * 0.0f;
            return;
        }
        animator.SetFloat("Status", 1.0f);


        rb.gravityScale = gravity;

        if (Input.GetKeyDown(KeyCode.Escape) && gm.gameState == GameManager.GameState.GAME)
        {
            gm.ChangeState(GameManager.GameState.PAUSE);
        }

        float yInput = Input.GetAxis("Vertical");
        float xInput = Input.GetAxis("Horizontal");

        //Thrust(xInput, yInput);

        if (yInput != 0 || xInput != 0)
        {
            Shoot();
        }



        if (Input.GetAxisRaw("Jump") != 0)
        {
            animator.SetFloat("Velocity", 1.0f);

            GoUp();
        }
        else
        {
            animator.SetFloat("Velocity", -1.0f);
        }

        // Timer bar
        if (maxGun)
        {
            if (currentTime >= 0)
            {
                currentTime -= Time.deltaTime;
                timeBar.SetTime(currentTime);
            }
            else
            {
                timeBar.gameObject.SetActive(false);
                maxGun = false;
            }
        }
    }
Exemple #3
0
 void SubtractTime(int time)
 {
     currentTime -= time;
     timeBar.SetTime(currentTime);
 }
Exemple #4
0
 // Use this in regular timer countdown
 private void UpdateHealthTimer()
 {
     _healthTimer -= Time.deltaTime;
     _timeBar.SetTime(_healthTimer);
 }