Ejemplo n.º 1
0
    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();
        }
    }
Ejemplo n.º 2
0
    private void Update()
    {
        engine.SetMovementDirection(CalculateMovementVector());
        engine.SetVelocity(player.PlayerMovementSpeed);
        engine.SetTargetPosition(CalculateTargetPosition());

        FireControll();
    }
Ejemplo n.º 3
0
    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;
            }
        }
    }