public void StartNewTrack()
 {
     if (!Active)
     {
         return;
     }
     Debug.Log("BuildDialogState: StartNewTrack");
     m_buildSM.CurrentTrackData = TrackData.CreateRandomizedTrackData();
     m_splineManager.ClearMesh();
     m_featurePointManager.ClearFeaturePoints();
     m_stateMachine.TransitionToState(StateName.BUILD_PAINT_STATE);
 }
    public override void EnterState()
    {
        base.EnterState();
        Debug.Log("BuildObserveState entered!");
        m_subscriptions = new CompositeDisposable();

        // clear existing feature points
        m_featurePointsManager.ClearFeaturePoints();

        IObservable <TrackData> observable;

        if (m_observeDialogUI.DoReceiveLiveUpdates)
        {
            observable = m_useCase.ObserveTrack(m_observeDialogUI.KeyToDownload);
        }
        else
        {
            observable = m_useCase.GetTrack(m_observeDialogUI.KeyToDownload);
        }

        // update session and rebuild track when an update from the server was received
        m_subscriptions.Add(observable
                            .SubscribeOn(Scheduler.ThreadPool)
                            .ObserveOnMainThread()
                            .Subscribe(
                                UpdateTrack,
                                e => { m_dialogBuilderFactory.Create().MakeGenericExceptionDialog(e); },
                                () => { }));

        // rebuild track if the track move tool was used
        m_subscriptions.Add(m_signalBus.GetStream <FeaturePointChanged>()
                            .SubscribeOn(Scheduler.ThreadPool)
                            .ObserveOnMainThread()
                            .Subscribe(
                                _ => RebuildTrack(),
                                e => { m_dialogBuilderFactory.Create().MakeGenericExceptionDialog(e); },
                                () => { }));
    }