// Update is called once per frame void Update() { if (timeToFire > 0) { timeToFire -= Time.deltaTime; } if (Input.GetButton("Fire1") && timeToFire <= 0) { if (currAmmo != 0 && !reloading) { Fire(); timeToFire = fireRate * (1 - (mFireRate)); } } if (Input.GetButton("Fire1") && currAmmo != 0) { arms.SetBool("fire", true); if (barrel != null && !reloading) { barrel.Spin(); } } else { arms.SetBool("fire", false); } if (Input.GetButton("Reload") && !reloading && currAmmo != (int)(maxAmmo * (1 + (mAmmo)))) { arms.Play("Rifle_Reload", 0, 0.0f); // Play the reload animation. reloading = true; } if (Input.GetKeyDown(KeyCode.LeftAlt)) { MaxUpgrades(); } //god mode (max upgrades / min upgrades toggle) if (Input.GetKeyDown(KeyCode.Equals)) { ModifyAll(true); } //increase all mod levels by 1 if (Input.GetKeyDown(KeyCode.Minus)) { ModifyAll(false); } //decrease all mod levels by 1 }
// Update is called once per frame void Update() { //Debug.DrawRay(firingPosition.transform.position, firingPosition.transform.forward * range, Color.red, 2f); if (timeToFire > 0) { timeToFire -= Time.deltaTime; } if (Input.GetButton("Fire1") && timeToFire <= 0) { if (currAmmo != 0 && !reloading) { Fire(); timeToFire = fireRate * (1 - (fireRatePercentReduction * fireRateUpgrade)); } } if (Input.GetButton("Fire1") && currAmmo != 0) { firstPersonArms_Animator.SetBool("fire", true); if (barrel != null && !reloading) { barrel.Spin(); } } else { firstPersonArms_Animator.SetBool("fire", false); } if (Input.GetButton("Reload") && !reloading && currAmmo != (int)(maxAmmo * (1 + (ammoCapPercentIncrease * ammoUpgrade)))) { firstPersonArms_Animator.Play("Rifle_Reload", 0, 0.0f); // Play the reload animation. reloading = true; //StartCoroutine(Reload()); } }