Exemplo n.º 1
0
    public void loadDetails(OrbitalDetails orbitalDetails)
    {
        base.loadDetails(orbitalDetails.getRadius(), orbitalDetails.getMass());

        semiMinorAxis         = orbitalDetails.getSemiMinorAxis();
        semiMajorAxis         = orbitalDetails.getSemiMajorAxis();
        eccentricity          = orbitalDetails.getEccentricity();
        foci1                 = new Vector3(orbitalDetails.getFoci1()[0], orbitalDetails.getFoci1()[1], orbitalDetails.getFoci1()[2]);
        foci2                 = new Vector3(orbitalDetails.getFoci2()[0], orbitalDetails.getFoci2()[1], orbitalDetails.getFoci2()[2]);
        centre                = new Vector3(orbitalDetails.getCentre()[0], orbitalDetails.getCentre()[1], orbitalDetails.getCentre()[2]);
        localCentreVector     = new Vector3(orbitalDetails.getLocalCentreVector()[0], orbitalDetails.getLocalCentreVector()[1], orbitalDetails.getLocalCentreVector()[2]);
        currentTheta          = orbitalDetails.getCurrentTheta();
        cosineEllipseRotation = orbitalDetails.getCosineEllipseRotation();
        sineEllipseRotation   = orbitalDetails.getSineEllipseRotation();
        distanceFromFoci      = orbitalDetails.getDistanceFromFoci();

        gameObject.transform.localPosition = getPositionInOrbit(currentTheta);
    }
    public SerializableOrbitDetails(OrbitalDetails orbitalDetails)
    {
        radius                = orbitalDetails.getRadius();
        mass                  = orbitalDetails.getMass();
        semiMinorAxis         = orbitalDetails.getSemiMinorAxis();
        semiMajorAxis         = orbitalDetails.getSemiMajorAxis();
        eccentricity          = orbitalDetails.getEccentricity();
        foci1                 = orbitalDetails.getFoci1();
        foci2                 = orbitalDetails.getFoci2();
        centre                = orbitalDetails.getCentre();
        localCentreVector     = orbitalDetails.getLocalCentreVector();
        currentTheta          = orbitalDetails.getCurrentTheta();
        cosineEllipseRotation = orbitalDetails.getCosineEllipseRotation();
        sineEllipseRotation   = orbitalDetails.getSineEllipseRotation();
        distanceFromFoci      = orbitalDetails.getDistanceFromFoci();

        List <SerializableOrbitDetails> children = new List <SerializableOrbitDetails>();

        foreach (OrbitalDetails currentOrbitalDetails in orbitalDetails.getOrbitingBodies())
        {
            children.Add(new SerializableOrbitDetails(currentOrbitalDetails));
        }
        orbitingBodies = children;
    }