예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKey(KeyCode.C))
     {
         _primaryGun.Shoot();
     }
 }
예제 #2
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();
            }
        }
    }
예제 #3
0
    private void UseWeapon()
    {
        if (holdingItem != null && MOVER_FLAGS.isShooting)
        {
            switch (holdingItem.GetType().ToString())
            {
            case "GunBase":
                GunBase holdingGun = holdingItem as GunBase;
                holdingGun.Shoot();
                break;

            case "MeleeBase":
                MeleeBase holdingMelee = holdingItem as MeleeBase;
                holdingMelee.Hit();
                break;
            }
        }
    }
예제 #4
0
 private void FixedUpdate()
 {
     _gun.Shoot();
     _transform.position = Vector3.MoveTowards(_transform.position, _transform.position + _direction * _speed * Time.fixedDeltaTime, _speed);
 }