private void FireUpdate()
    {
        if (_audioManager != null)
        {
            _audioManager.Play("Laser");
        }

        if (_ammoDisplay != null)
        {
            _ammoDisplay.UpdateAmmo();
        }
        GameEvents.current.LaserFired();
    }
示例#2
0
        protected override void Shoot()
        {
            // Point the projectile at the cursor.
            var forward  = _camera.forward;
            var position = _camera.position;
            var ray      = new Ray(position, forward);

            TargetPoint = position + forward * 100;
            var layerMask = LayerMask.GetMask("Player");

            if (Physics.Raycast(ray, out var hit, 100f, layerMask))
            {
                TargetPoint = hit.point;
            }
            // Update the ammo ui.
            _ammoDisplay.UpdateAmmo(Inventory.GetAmmo());
            base.Shoot();
        }
示例#3
0
 public override void ReloadFinish()
 {
     base.ReloadFinish();
     _ammoDisplay.UpdateAmmo(Inventory.GetAmmo());
 }