Example #1
0
 public bool TryGetAsteroidData(string id, out AsteroidData data)
 {
     if (mAsteroids.ContainsKey(id))
     {
         data = mAsteroids[id];
         return(true);
     }
     data = null;
     return(false);
 }
Example #2
0
        public void Load(string xml)
        {
            mAsteroids.Clear();
            XDocument document = XDocument.Parse(xml);

            mAsteroids = document.Element("asteroids").Elements("asteroid").Select(e => {
                AsteroidData data = new AsteroidData(e);
                return(data);
            }).ToDictionary(d => d.ID, d => d);
        }