예제 #1
0
    // Use this for initialization
    void Start()
    {
        GravityEngine ge = GravityEngine.Instance();

        time.text = string.Format(time_format, ge.GetTimeWorldSeconds(), ge.GetTimeZoom());
        Vector3 pos = ship.initialPos;

        position.text = string.Format(pos_format, pos.x, pos.y, pos.z);
        velocity.text = string.Format(vel_format, 0f, 0f, 0f);
        if (rocketEngine == null)
        {
            Debug.LogError("Need a rocket component");
        }
        fuelText.text = string.Format(fuel_format, rocketEngine.GetFuel());
        attitude.text = string.Format(attitude_format, 0f, 0f, 0f);

        // assume earth at (0,0,0)
        initial_altitude = Vector3.Magnitude(ship.transform.position) - (float)atmosphere.heightEarthSurface;
        altitude.text    = string.Format(altitude_format, initial_altitude);

        if (drag != null)
        {
            drag.text = string.Format(drag_format, atmosphere.GetAccelSI());
        }

        if (accel != null)
        {
            accel.text = string.Format(accel_format, earthRocket.GetAccel());
        }

        if (thrust != null)
        {
            thrust.text = string.Format(thrust_format, 100f);
        }
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        GravityEngine ge = GravityEngine.Instance();

        time.text = string.Format(time_format, ge.GetPhysicalTime(), ge.GetTimeZoom());
        Vector3 pos = ship.initialPos;

        position.text = string.Format(pos_format, pos.x, pos.y, pos.z);
        velocity.text = string.Format(vel_format, 0f, 0f, 0f);
        RocketEngine rocketEngine = ship.GetComponent <RocketEngine>();

        if (rocketEngine == null)
        {
            Debug.LogError("Need a rocket component");
        }
        fuelText.text = string.Format(fuel_format, rocketEngine.GetFuel(ge.GetPhysicalTime()));
        attitude.text = string.Format(attitude_format, 0f, 0f, 0f);

        // assume earth at (0,0,0)
        initial_altitude = Vector3.Magnitude(ship.transform.position);
        altitude.text    = string.Format(altitude_format, 0f);
    }