void Update() { if (!movement.IsStopped() && !isBurningFuel && fuel < 1f) { SetFuel(fuel + Time.deltaTime * fuelRegeneration); } }
void Update() { bool isUpPressed = (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W)); bool isDownPressed = (Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.S)); if (isUpPressed && !isDownPressed) { shipMovement.AccelerateUp(); } if (isDownPressed && !isUpPressed) { shipMovement.AccelerateDown(); } if (Input.GetKeyDown(KeyCode.Space)) { if (shipMovement.IsStopped()) { SceneManager.LoadScene("MainMenu"); } else { shipBehaviour.Shoot(); } } }
private void ActOnTouch(float x, float y, TouchPhase phase) { if (player.lives <= 0 || ship.IsStopped()) { return; } if (x > _camera.pixelWidth * 0.5f) { ApplyCurrentControlOption(y, phase); } else if (x < _camera.pixelWidth * 0.5f && y <= _camera.pixelHeight * 0.5f) { player.Shoot(); } else if (x < _camera.pixelWidth * 0.5f && y > _camera.pixelHeight * 0.5f) { player.DashForward(); } }