예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (!hasAuthority)
        {
            return;
        }
        if (numberOfShots <= 0)
        {
            Timer.HunterWin  = (false);
            Timer.HunterLose = (true);
        }
        if (Input.GetMouseButtonDown(1))   // look down scope
        {
            scoping = !scoping;
            Debug.Log("scoping");
            if (scoping)
            {
                hunterHeadAnimator.ResetTrigger("StopAiming");
                hunterHeadAnimator.SetTrigger("Aim");
                audioManager.ZoomIn();
            }
            else
            {
                hunterHeadAnimator.ResetTrigger("Aim");
                hunterHeadAnimator.SetTrigger("StopAiming");
            }
        }

        if (Input.GetMouseButtonDown(0) && !startWait && numberOfShots > 0)   // shoot sniper
        {
            startWait = true;
            Debug.Log("Bang");

            CmdShoot();

            hunterHeadAnimator.SetTrigger("Fire");
            numberOfShots--;
            bulletText.text = numberOfShots.ToString();
            // update some sort of UI to let the player know how many bullets they have left
        }

        if (startWait)
        {
            waitValue -= Time.deltaTime;
            if (waitValue <= 0f)
            {
                startWait = false;
                waitValue = shootWait;
            }
        }
    }