public NetworkManager(RTCore core)
        {
            mCore          = core;
            MissionControl = new MissionControlSatellite();
            Graph          = new Dictionary <Guid, List <ISatellite> >();
            Planets        = GeneratePlanetGuidMap();

            OnSatelliteRegister(MissionControl);

            mCore.Satellites.Registered   += OnSatelliteRegister;
            mCore.Satellites.Unregistered += OnSatelliteUnregister;
            mCore.PhysicsUpdated          += OnPhysicsUpdate;
        }
Beispiel #2
0
        /// <summary>
        /// Adds a new ground station to the list.
        /// </summary>
        /// <param name="name">Name of the ground station</param>
        /// <param name="latitude">Latitude position</param>
        /// <param name="longitude">Longitude position</param>
        /// <param name="height">Height above sea level</param>
        /// <param name="body">Reference body 1=Kerbin etc...</param>
        /// <returns>A new <see cref="Guid"/> if a new station was successfully added otherwise a Guid.Empty.</returns>
        public Guid AddGroundStation(string name, double latitude, double longitude, double height, int body)
        {
            RTLog.Notify("Trying to add ground station({0})", RTLogLevel.LVL1, name);

            var newGroundStation = new MissionControlSatellite();

            newGroundStation.SetDetails(name, latitude, longitude, height, body);

            // Already on the list?
            var foundGroundStation = GroundStations.FirstOrDefault(ms => ms.GetDetails().Equals(newGroundStation.GetDetails()));

            if (foundGroundStation != null)
            {
                RTLog.Notify("Ground station already exists!");
                return(Guid.Empty);
            }

            GroundStations.Add(newGroundStation);
            Save();

            return(newGroundStation.mGuid);
        }