void Update() { if (Time.timeScale == 1) { int i = fireLevel; i = (i > numberOfSpawn) ? numberOfSpawn : i; if (Input.GetKey(dataController.GetKeyInput(Constants.KEYMAINATTACK))) { if (!isFocus && Time.time > nextFire) { nextFire = Time.time + fireRate; arsenal.Fire(mainShotSpawn, fireType, gameObject.tag); for (; i >= 0; --i) { shotSpawnLeft[i].rotation = Quaternion.Euler(0.0f, 0.0f, 0.0f); shotSpawnRight[i].rotation = Quaternion.Euler(0.0f, 0.0f, 0.0f); arsenal.Fire(shotSpawnLeft[i], fireType, gameObject.tag); arsenal.Fire(shotSpawnRight[i], fireType, gameObject.tag); } } else if (isFocus && energy - 4 > 0 && Time.time > nextRegen) { amountEnergy = -10f; energy = energy - 10; nextRegen = Time.time + regenRate; if (specialShot == null) { specialShot = arsenal.SpecialFire(gameObject, fireSpecialType); swScript = specialShot.GetComponent <SpecialWeapon> (); } swScript.FillUp(); } } else if (Input.GetKey(dataController.GetKeyInput(Constants.KEYALTATTACK)) && Time.time > nextFire) { nextFire = Time.time + fireRate; int magnitudeX = (isFocus) ? 0 : 5; arsenal.Fire(mainShotSpawn, fireType, gameObject.tag); for (; i >= 0; --i) { shotSpawnLeft[i].LookAt(new Vector3(transform.position.x + (-1 * magnitudeX * (i + 1)), 0, zPosition)); shotSpawnRight[i].LookAt(new Vector3(transform.position.x + (magnitudeX * (i + 1)), 0, zPosition)); arsenal.Fire(shotSpawnLeft[i], fireType, gameObject.tag); arsenal.Fire(shotSpawnRight[i], fireType, gameObject.tag); } } if (energy < Constants.ENERGYMAX && Time.time > nextRegen) { nextRegen = Time.time + regenRate; amountEnergy = 2.5f; energy = energy + 2.5f; } if (energy > Constants.ENERGYMAX) { energy = Constants.ENERGYMAX; } else if (energy < 0) { energy = 0; } uiController.UpdateEnergy(energy - ((nextRegen - Time.time) / regenRate * amountEnergy)); if (bomb > 0 && Input.GetKey(dataController.GetKeyInput(Constants.KEYBOMB)) && Time.time > nextBombFire) { --bomb; nextBombFire = Time.time + fireBombRate; arsenal.Fire(transform, Constants.BOMB, gameObject.tag); playerController.UpdatePlayerInfoUI(); } if (Input.GetKeyDown(dataController.GetKeyInput(Constants.KEYSWITCH))) { isFocus = !isFocus; } } }