class NcartStationMarker extends GameObject
{
	protected instanceeditable var m_station : ENcartStations;
	protected instanceeditable var m_callBackOnlyIfMatchesDestination : Bool;
	default m_callBackOnlyIfMatchesDestination = true;
	protected instanceeditable var m_setAsNewActive : Bool;
	default m_setAsNewActive = true;
	protected instanceeditable var m_onTrainApproachingFact : CName;
	default m_onTrainApproachingFact = 'ue_metro_arriving_at_station';
	protected instanceeditable var m_TrainGlobalRef : CName;

	protected event OnAreaEnter( trigger : AreaEnteredEvent )
	{
		var vehicle : weak< VehicleObject >;
		var nextStation : Int32;
		vehicle = ( ( VehicleObject )( EntityGameInterface.GetEntity( trigger.activator ) ) );
		if( vehicle == ( ( ncartMetroObject )( vehicle ) ) )
		{
			nextStation = GameInstance.GetQuestsSystem( GetGame() ).GetFact( 'ue_metro_next_station' );
			if( ( GetMetroStationNumber( m_station ) != nextStation ) && m_callBackOnlyIfMatchesDestination )
			{
				return false;
			}
			if( m_setAsNewActive )
			{
				GameInstance.GetQuestsSystem( GetGame() ).SetFact( 'ue_metro_active_station', GetMetroStationNumber( m_station ) );
			}
			GameInstance.GetQuestsSystem( GetGame() ).SetFact( m_onTrainApproachingFact, 1 );
		}
	}

	protected event OnAreaExit( trigger : AreaExitedEvent ) {}

	private const function GetMetroStationNumber( stationName : ENcartStations ) : Int32
	{
		switch( stationName )
		{
			case ENcartStations.ARASAKA_WATERFRONT:
				return 1;
			case ENcartStations.LITTLE_CHINA_HOSPITAL:
				return 2;
			case ENcartStations.LITTLE_CHINA_NORTH:
				return 3;
			case ENcartStations.LITTLE_CHINA_SOUTH:
				return 4;
			case ENcartStations.JAPAN_TOWN_NORTH:
				return 5;
			case ENcartStations.JAPAN_TOWN_SOUTH:
				return 6;
			case ENcartStations.DOWNTOWN_NORTH:
				return 7;
			case ENcartStations.ARROYO:
				return 8;
			case ENcartStations.CITY_CENTER:
				return 9;
			case ENcartStations.ARASAKA_TOWER:
				return 10;
			case ENcartStations.WELLSPRINGS:
				return 11;
			case ENcartStations.GLEN_NORTH:
				return 12;
			case ENcartStations.GLEN_SOUTH:
				return 13;
			case ENcartStations.VISTA_DEL_REY:
				return 14;
			case ENcartStations.RANCHO_CORONADO:
				return 15;
			case ENcartStations.LITTLE_CHINA_MEGABUILDING:
				return 16;
			case ENcartStations.CHARTER_HILL:
				return 17;
			case ENcartStations.GLEN_EBUNIKE:
				return 18;
			case ENcartStations.PACIFICA_STADIUM:
				return 19;
		}
		return 0;
	}

}

