예제 #1
0
    protected void WeaponInputs()
    {
        if (Input.GetMouseButton(1))
        {
            if (!gun.isAiming)
            {
                gun.StartAiming();
            }
            else
            {
                if (gun.automatic && Input.GetMouseButton(0))
                {
                    gun.Shoot();
                }
                else if (Input.GetMouseButtonDown(0))
                {
                    gun.Shoot();
                }
            }
        }
        else if (gun.isAiming)
        {
            gun.StopAiming();
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            if (gun.CanAttemptFastReload())
            {
                gun.AttemptFastReload();
            }
            else if (gun.CanReload())
            {
                gun.StartReload();
            }
        }
    }