示例#1
0
    void Update()
    {
        base.onUpdate();

        if (!inputDisabled && Time.timeScale > 0)
        {
            if (Input.GetAxisRaw("Fire1") > 0)
            {
                shootComponent.shoot();
            }
            if (Input.GetAxisRaw("Reload1") > 0)
            {
                shootComponent.reload();
            }
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                shootComponent.changeWeapon(0);
            }
            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                shootComponent.changeWeapon(1);
            }

            xAxis = Input.GetAxisRaw("Horizontal");

            hotbar.UpdateAmmoCount(shootComponent.CurrentWeapon().GetMagazine(),
                                   shootComponent.CurrentWeapon().GetAmmo());
        }
    }