GetSimulator() public static method

Gets the singleton simulator instance
public static GetSimulator ( ) : Simulator
return Simulator
コード例 #1
0
 /// <summary>
 /// Train name was entered for a new train
 /// </summary>
 /// <param name="value">Train name</param>
 private void OnTrainNameEntered(string value)
 {
     if (!string.IsNullOrEmpty(value))
     {
         Simulator.GetSimulator().SpawnNewTrain(m_selectedTrackBlock, value);
         CloseOpenPopups();
     }
     else
     {
         ShowOKPopup("Error", "Train name cannot be empty", OnPopupAcknowledged);
     }
 }
コード例 #2
0
        /// <summary>
        /// Event handler for the train clicked event
        /// </summary>
        /// <param name="train">Train that was clicked</param>
        private void OnTrainClicked(ITrain train)
        {
            m_log.LogInfo("Train was clicked");
            m_selectedTrackBlock = null;
            m_selectedTrain      = train;
            infoPanel.SetTrainInfo(train);
            commandPanel.ShowTrainCommands();

            if (m_trainGUI != null)
            {
                m_trainGUI.Close();
            }

            TrainController trainController = Simulator.GetSimulator().GetTrainController(train);

            if (trainController != null)
            {
                m_trainGUI = new TrainOperator(train, trainController);
                m_trainGUI.Show();
            }

            CloseOpenPopups();
        }