Пример #1
0
    private void Update()
    {
        //Shoot Function
        if (Input.GetMouseButton(0) && (Time.time > nextFire) && canShoot)
        {
            nextFire = Time.time + fireRate;
            Shoot();
        }

        //Level Up
        if (xp >= xpForNextLevel)
        {
            LevelUp();
            health.RegenHealthFull();
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        shooting.cooldownTimer -= Time.deltaTime;

        //Shoot
        if (Input.GetKey(KeyCode.Space) && shooting.cooldownTimer <= 0)
        {
            shooting.Shoot(true);
        }

        //Quit game
        if (Input.GetKey(KeyCode.Escape) == true)
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex - 1);
        }

        //Level up
        if (xp >= xpForNextLevel)
        {
            LevelUp();
            shooting.ChangeWeapon();
            health.RegenHealthFull();
        }
    }