Esempio n. 1
0
 private OrbitalBody(BinaryReader load)
 {
     orbitalBodyID     = load.ReadInt32();
     orbitalBodyNameID = load.ReadInt32();
     solarSystemID     = load.ReadInt32();
     celestialIndex    = load.ReadInt32();
     typeID            = load.ReadInt32();
     radius            = load.ReadDouble();
     position          = new Location(load);
     if (load.ReadBoolean())
     {
         attributes = new OrbitalBodyAttributes(load);
     }
     else
     {
         attributes = null;
     }
     if (load.ReadBoolean())
     {
         statistics = new OrbitalBodyStatistics(load);
     }
     else
     {
         statistics = null;
     }
     Loader.Load(out moons, load);
     Loader.Load(out stations, load);
     Loader.Load(out asteroidBelts, load);
 }
Esempio n. 2
0
        private OrbitalBody(YamlNode node, int _planetID, int _solarSystemID)
        {
            orbitalBodyID = _planetID;
            solarSystemID = _solarSystemID;
            YamlMappingNode mapping = (YamlMappingNode)node;

            foreach (var entry in mapping.Children)
            {
                string paramName = entry.Key.ToString();
                switch (paramName)
                {
                case "celestialIndex":
                    celestialIndex = Int32.Parse(entry.Value.ToString());
                    break;

                case "asteroidBeltNameID":
                case "moonNameID":
                case "planetNameID":
                    orbitalBodyNameID = Int32.Parse(entry.Value.ToString());
                    break;

                case "typeID":
                    typeID = Int32.Parse(entry.Value.ToString());
                    break;

                case "radius":
                    radius = Double.Parse(entry.Value.ToString());
                    break;

                case "position":
                    position = Location.ParseLocation(entry.Value);
                    break;

                case "planetAttributes":
                    attributes = new OrbitalBodyAttributes(entry.Value);
                    break;

                case "statistics":
                    statistics = new OrbitalBodyStatistics(entry.Value);
                    break;

                case "moons":
                    moons = OrbitalBody.LoadYAML(entry.Value, _solarSystemID);
                    break;

                case "asteroidBelts":
                    asteroidBelts = OrbitalBody.LoadYAML(entry.Value, _solarSystemID);
                    break;

                case "npcStations":
                    stations = NPCStation.LoadYAML(entry.Value, _solarSystemID);
                    break;

                default:
                    System.Diagnostics.Debug.WriteLine("OrbitalBody unknown value:" + entry.Key + " = " + entry.Value);
                    break;
                }
            }
        }