コード例 #1
0
    private void FireUsingKeyboard()
    {
        if (Input.GetKeyUp(InputManager.Instance.Fire))
        {
            if (_holdData.HoldingDownTrigger)
            {
                PrepareHoldShot();
            }
            else if (Time.time > _timeTillShotAllowed)
            {
                PrepareSingleShot();
            }
            FireShot();
            ResetData();
        }
        else if (_holdData.HoldingDownTrigger)
        {
            WeaponAnimator.SetBool("HoldCharge", true);
        }

        // Determine if we should queue a hold fire shot
        if (Input.GetKeyDown(InputManager.Instance.Fire) && !_holdData.HoldingDownTrigger)
        {
            _holdData.HoldingQueued = true;
            // Wait 1/10th of a second to set the holding
            Invoke("InvokeHolding", 0.25f);
        }
    }
コード例 #2
0
    private void Update()
    {
        if (HasAmmo)
        {
            CheckAmmo();
        }

        WeaponAnimator.SetBool("UltMode", UltMode);

        ResolveLaserType();

        var fireButton = Input.GetAxis(Player.JoystickId + GameConstants.Input_RTrigger);

        if (Input.GetKeyDown(InputManager.Instance.Fire) || fireButton > WeaponConfig.TriggerFireThreshold || _holdingDownFire)
        {
            PrepareLaser();
            GenerateLaser();
        }
        if (Input.GetKeyUp(InputManager.Instance.Fire) || (JoystickManagerController.Instance.ConnectedControllers() > 0 && fireButton == 0))
        {
            _holdingDownFire      = false;
            _currentLaser.enabled = false;
            _laserSoundPlaying    = false;
            AudioManager.Instance.StopSound(GameConstants.Audio_EmissionIndexShot);
        }
    }
コード例 #3
0
    private void Update()
    {
        Damage = UltMode ? _ultModeDamage : _defaultDamage;

        var rightTrigger = Input.GetAxis(Player.JoystickId + GameConstants.Input_RTrigger);

        if (!_triggerLetGo)
        {
            if (rightTrigger <= WeaponConfig.TriggerFireThreshold && !Input.GetKey(InputManager.Instance.Fire))
            {
                _triggerLetGo = true;
            }
        }

        // Degub only rendering the raycasts to see them in action
        for (var i = 1; i < _debugBlastRotations.Length; ++i)
        {
            Debug.DrawRay(_debugBlastRotations[0], _debugBlastRotations[i] * ShotgunConfig.RayLength, Color.green);
        }

        HandleShootingInput(rightTrigger);

        if (HasAmmo)
        {
            CheckAmmo();
        }
        WeaponAnimator.SetBool("UltModeActive", UltMode);
    }
コード例 #4
0
 /// <summary>
 /// Fire an awesome charged up bullet that explodes on impact or after it reaches its max lifetime
 /// </summary>
 private void PrepareHoldShot()
 {
     CancelInvoke("InvokeHolding");
     WeaponAnimator.SetBool("HoldCharge", false);
     _chargeShotFired = true;
     BulletPrefab     = BulletPrefabs[(int)BulletType.CHARGED];
     AudioManager.Instance.PlaySound(GameConstants.Audio_GaussShotCharged);
 }
コード例 #5
0
 private void Update()
 {
     HandleShootingInput();
     if (HasAmmo)
     {
         CheckAmmo();
     }
     WeaponAnimator.SetBool("UltModeActive", UltMode);
 }
コード例 #6
0
    // Update is called once per frame
    void Update()
    {
        CamAnimator.SetBool("Running", Input.GetKey(KeyCode.W));
        WeaponAnimator.SetBool("Fire", Input.GetKey(KeyCode.Space));

        if (Input.GetKey(KeyCode.W))
        {
            transform.position = transform.position + transform.forward * moveSpeed * Time.deltaTime;
        }
    }
コード例 #7
0
        public override void Fire()
        {
            if (DestinyEngineController.main.IsGamePaused)
            {
                return;
            }

            if (doFire == false)
            {
                return;
            }
            if (isSprinting)
            {
                return;
            }
            if (Is_Reloading)
            {
                return;
            }
            if (Is_Cooldown)
            {
                return;
            }
            else if (MagazineCurrent <= 0)
            {
                WeaponAnimator.SetBool("Fire", false);

                if (noAmmoSource != null)
                {
                    if (noAmmoSource.isPlaying == false)
                    {
                        noAmmoSource.Play();
                    }
                }
                return;
            }

            internalCooldownTimer = cooldownFire;
            Is_Cooldown           = true;
            if (MagazineCurrent > 0)
            {
                MagazineCurrent -= 1;
            }

            WeaponAnimator.SetBool("Fire", true);
            gunFireSource.Play();

            SaveFlag();
            Impact();
            Recoil();
        }
コード例 #8
0
    private void Update()
    {
        WeaponAnimator.SetBool("FireUlt", UltMode);

        if (UltMode)
        {
            HandleUltShootingInput();
        }
        else
        {
            ResolveShootingInput();
        }
        if (HasAmmo)
        {
            CheckAmmo();
        }
    }
コード例 #9
0
        private void Update()
        {
            if (DestinyEngineController.ExamplePlayer.IsPlayerWalking())
            {
                WeaponAnimator.SetFloat("Moving", 1f);
            }
            else
            {
                WeaponAnimator.SetFloat("Moving", 0f);
            }

            if (DestinyEngineController.ExamplePlayer.IsPlayerSprinting())
            {
                isSprinting = true;
            }
            else
            {
                isSprinting = false;
            }

            if (isSprinting)
            {
                WeaponAnimator.SetBool("isSprinting", true);
            }
            else
            {
                WeaponAnimator.SetBool("isSprinting", false);
            }

            if (Is_Cooldown)
            {
                internalCooldownTimer -= 1 * Time.deltaTime;

                if (internalCooldownTimer < 0)
                {
                    Is_Cooldown = false;
                }
            }
        }
コード例 #10
0
    private void FireUsingController()
    {
        var rightTrigger = Input.GetAxis(Player.JoystickId + GameConstants.Input_RTrigger);

        if (_holdData.HoldingDownTrigger && (rightTrigger == 0))
        {
            PrepareHoldShot();
            FireShot();
            ResetData();
        }
        else if (_holdData.HoldingDownTrigger)
        {
            WeaponAnimator.SetBool("HoldCharge", true);
        }
        else if (rightTrigger > WeaponConfig.TriggerFireThreshold)
        {
            _holdData.TriggerPressed = true;
        }
        else
        {
            if (_holdData.TriggerPressed && Time.time > _timeTillShotAllowed)
            {
                PrepareSingleShot();
                FireShot();
            }
            ResetData();
        }

        // Determine if we should queue a hold fire shot
        if (_holdData.TriggerPressed && !_holdData.HoldingDownTrigger && !_holdData.HoldingQueued)
        {
            _holdData.HoldingQueued = true;
            // Wait 1/10th of a second to set the holding
            Invoke("InvokeHolding", 0.25f);
        }
    }
コード例 #11
0
 public override void Inaction()
 {
     WeaponAnimator.SetBool("Fire", false);
 }
コード例 #12
0
 protected override void ApplyRecoil()
 {
     WeaponAnimator.SetBool("ApplyRecoil", true);
     StartCoroutine(ResetWeaponPosition());
 }
コード例 #13
0
 protected override void ApplyRecoil()
 {
     WeaponAnimator.SetBool("ApplyRecoil", true);
     StartCoroutine(ResetWeaponPosition());
     AudioManager.PlaySound(GameConstants.Audio_FuzzBuster);
 }