private void Update() { if (Input.GetKey(KeyCode.UpArrow)) { shipSpeed += ship.ShipAcceleration; engine.SetVelocity(shipSpeed); } if (Input.GetKey(KeyCode.DownArrow)) { shipSpeed -= ship.ShipAcceleration; engine.SetVelocity(shipSpeed); } if (Input.GetKey(KeyCode.LeftArrow)) { Quaternion newRotation = transform.rotation * Quaternion.Euler(0f, 0f, ship.ShipRotationSpeed); engine.SetRotation(newRotation); } if (Input.GetKey(KeyCode.RightArrow)) { Quaternion newRotation = transform.rotation * Quaternion.Euler(0f, 0f, -ship.ShipRotationSpeed); engine.SetRotation(newRotation); } if (Input.GetKeyDown(KeyCode.H)) { ship.SpawnPlane(); } }
private void Update() { engine.SetMovementDirection(CalculateMovementVector()); engine.SetVelocity(player.PlayerMovementSpeed); engine.SetTargetPosition(CalculateTargetPosition()); FireControll(); }
void Update() { engine.SetVelocity(CalculateVelocity()); engine.SetRotation(CalculateRotation()); if (!isLanding) { flightTimer += Time.deltaTime; if (flightTimer > maxFlightTime) { float landingTime = Utils.FindReturnTime(planeRadius, Utils.GetMiddleValue(minSpeed, maxSpeed)); LandingSignal(landingTime); isLanding = true; } } }