Exemple #1
0
    void Update()
    {
        // --- Panel de control
        float handleRotation = functionBank.Map(airplanePhysical.potency, 0, 1, -15, 60);

        handle.transform.localRotation  = Quaternion.Euler(new Vector3(handleRotation, 0, 0));
        compass.transform.localRotation = Quaternion.Euler(new Vector3(0, -rotation.y, 0));
        float speedometerRotation = functionBank.Map(speed.z, 0, airplanePhysical.speedMax, -90, 90);

        speedometer.transform.localRotation = Quaternion.Euler(new Vector3(0, speedometerRotation, 0));
        float altimeterPosition = functionBank.Map(transform.position.y, 0, 50, -0.25f, 0.25f);

        altimeter.transform.localPosition = new Vector3(0, 0.5f, altimeterPosition);

        // --- Protocolo de despegue
        motorOn = airplaneOnButton.on;
        airplanePhysical.motorOn = motorOn;

        if (speed.z > airplanePhysical.speedMax * 0.75f)
        {
            if (transform.position.y > 2)
            {
                takeoff = true;
            }
            else
            {
                takeoff = false;
            }
        }

        // --- Objetos del avion...
        airplanePropeller.SetMove(motorOn);
    }
Exemple #2
0
    // Avion en tierra
    public Vector3 RotationTakeOn()
    {
        float x = rotation.x;
        float y = rotation.y;
        float z = rotation.z;

        y -= horInclination * 64 / mass;         // Un escalar para calibrar

        if (speed.z > speedMax * 0.75f)
        {
            x = functionBank.Map(verInclination, -1, 1, -20, 20);
        }

        rotation = new Vector3(x, y, z);
        return(rotation);
    }