Esempio n. 1
0
    public override bool Initialize(CelestialBodyLoader loader)
    {
        if (base.Initialize(loader))
        {
            List <float> floatList = null;

            if (false == loader.GetData(m_MeanLongitudeLabel, ref floatList))
            {
                Debug.LogError("Error");
                return(false);
            }
            m_MeanEquinoxData[(int)PlanetPositionUtility.OrbitalElements.MEAN_LONGITUDE_OF_PLANET].AddRange(floatList);

            if (false == loader.GetData(m_SemiMajorAxisOfOrbitLabel, ref floatList))
            {
                Debug.LogError("Error");
                return(false);
            }
            m_MeanEquinoxData[(int)PlanetPositionUtility.OrbitalElements.SEMI_MAJOR_AXIS_OF_ORBIT].AddRange(floatList);

            if (false == loader.GetData(m_EccentricityOfOrbitLabel, ref floatList))
            {
                Debug.LogError("Error");
                return(false);
            }
            m_MeanEquinoxData[(int)PlanetPositionUtility.OrbitalElements.ECCENTRICITY_OF_THE_ORBIT].AddRange(floatList);

            if (false == loader.GetData(m_InclinationOnPlaneOfEclipticLabel, ref floatList))
            {
                Debug.LogError("Error");
                return(false);
            }
            m_MeanEquinoxData[(int)PlanetPositionUtility.OrbitalElements.INCLINATION_ON_PLANE_OF_ECLIPTIC].AddRange(floatList);

            // ArgumentOfPerihelion (optional)
            if (loader.GetData(m_ArgumentOfPerihelionLabel, ref floatList))
            {
                m_MeanEquinoxData[(int)PlanetPositionUtility.OrbitalElements.ARGUMENT_OF_PERIHELION].AddRange(floatList);
            }

            // LongitudeOfAscendingNode (optional)
            if (loader.GetData(m_LongitudeOfAscendingNodeLabel, ref floatList))
            {
                m_MeanEquinoxData[(int)PlanetPositionUtility.OrbitalElements.LONGITUDE_OF_ASCENDING_NODE].AddRange(floatList);
            }

            m_CelestialType = CelestialType.Planet;

            return(true);
        }

        return(false);
    }
Esempio n. 2
0
    public virtual bool Initialize(CelestialBodyLoader loader)
    {
        // Has Orbit (optional)
        m_OrbitParentName = "";
        loader.GetData(m_OrbitFlagLabel, ref m_OrbitParentName);

        if (loader.m_Radius <= 0.0)
        {
            Debug.LogError("Error");
            return(false);
        }
        m_RadiusInKM = loader.m_Radius;

        // TODO: This is a sphere shaped calculation so will need to support other types eventually?
        // Initial scale is in game diameter (2 * radius)
        m_InitialScale = CelestialRadius * 2;

        Scale = 1;

        return(true);
    }