Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new StreetConnector at the given coordinate.
 /// </summary>
 /// <param name="coordinate">The position where this StreetConnector should be located</param>
 public StreetConnector(Coordinate coordinate)
 {
     id = NextID;
     this.coordinate = coordinate;
     building        = null;
     station         = null;
     health          = MAX_HEALTH;
     priority        = 0;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Disconnects the given PublicTransportStation from this StreetConnector.
        /// </summary>
        /// <param name="station">The PublicTransportStation that should be disconnected</param>
        /// <returns>The result of the disconnection try</returns>
        public DisconnectResult Disconnect(PublicTransportStation station)
        {
            if (this.station == station)
            {
                this.station = null;
            }
            else
            {
                return(DisconnectResult.NotConnected);
            }

            return(DisconnectResult.Disconnected);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Connects the given PublicTransportStation to this StreetConnector.
        /// </summary>
        /// <param name="station">The PublicTransportStation that should be connected</param>
        /// <returns>The result of the connection try</returns>
        public ConnectResult Connect(PublicTransportStation station)
        {
            if (this.station == station)
            {
                return(ConnectResult.AlreadyConnected);
            }

            if (this.station == null)
            {
                this.station = station;
            }
            else
            {
                return(ConnectResult.NoFreeSlot);
            }

            return(ConnectResult.Connected);
        }
Ejemplo n.º 4
0
 private static void Save(PublicTransportStation station)
 {
     stations.Add(station.ID, station);
 }