void Update() { //if(Input.GetKeyDown(KeyCode.M)) useFastBullets = !useFastBullets; //if(Input.GetKeyDown(KeyCode.N)) useIncreasedFireRate = !useIncreasedFireRate; if (playerInput.GetFireInput()) { if (Time.time > nextShot) { if (useFastBullets) { bulletPool.NewFastBullet(transform.position, transform.parent); } else { bulletPool.NewNormalBullet(transform.position, transform.parent); } if (useIncreasedFireRate) { nextShot = Time.time + (1f / increasedFireRate); } else { nextShot = Time.time + (1f / normalFireRate); } } } if (playerInput.GetSpecialInputDown()) { if (!specialWeapon.IsEmpty()) { if (specialWeapon.CanFire()) { specialWeapon.Fire(); } else { playerModel.Shine(new Color(0.5f, 0.5f, 0f)); float waitTime = specialWeapon.GetTimeToNextFire(); //Debug.Log("wait " + waitTime); } } else { playerModel.Shine(new Color(0.5f, 0f, 0f)); //Debug.Log("empty"); } } }
void Update() { if (Time.timeScale > 0f) { if (Input.GetKeyDown(KeyCode.M)) { useFastBullets = !useFastBullets; //TODO remove this. its just for testing } if (Input.GetKeyDown(KeyCode.N)) { useIncreasedFireRate = !useIncreasedFireRate; } if (playerInput.GetFireInput()) { if (Time.time > nextShot) { if (useFastBullets) { fastBulletPool.NewBullet(transform.position, GetBulletDirection()); } else { normalBulletPool.NewBullet(transform.position, GetBulletDirection()); } if (useIncreasedFireRate) { nextShot = Time.time + (1f / increasedFireRate); } else { nextShot = Time.time + (1f / normalFireRate); } } } if (playerInput.GetSpecialInputDown()) { if (!specialWeapon.IsEmpty()) { if (specialWeapon.CanFire()) { specialWeapon.Fire(); gui.SetSPWAmmoNumber(specialWeapon.GetAmmoCount()); gui.SetSPWDisplayState(false); } else { //TODO uisounds.playerrorsound() or something like that Debug.Log("wait"); } } else { //TODO uisounds.playerrorsound() or something like that Debug.Log("empty"); } } gui.SetSPWAmmoNumber(specialWeapon.GetAmmoCount()); gui.SetSPWDisplayState(specialWeapon.CanFire()); } }