Exemplo n.º 1
0
        public void Init()
        {
            Array16 <TransportLine> lines = Singleton <TransportManager> .instance.m_lines;

            for (ushort index = 0; (uint)index < lines.m_size; ++index)
            {
                if (LineWatcher.IsValid(ref lines.m_buffer[(int)index]))
                {
                    this._knownLines.Add(index);
                }
            }
            this._initialized = true;
        }
Exemplo n.º 2
0
 private void Update()
 {
     if (!this._initialized)
     {
         return;
     }
     if (this.SimulationLineCount > this.KnownLineCount)
     {
         Array16 <TransportLine> lines = Singleton <TransportManager> .instance.m_lines;
         for (ushort lineID = 0; (uint)lineID < lines.m_size; ++lineID)
         {
             if (LineWatcher.IsValid(ref lines.m_buffer[(int)lineID]) && this._knownLines.Add(lineID))
             {
                 TransportLineMod.SetLineDefaults(lineID);
                 Vector3 position     = Singleton <NetManager> .instance.m_nodes.m_buffer[(int)lines.m_buffer[(int)lineID].GetStop(0)].m_position;
                 ushort  closestDepot = TransportLineMod.GetClosestDepot(lineID, position);
                 if ((int)closestDepot != 0)
                 {
                     TransportLineMod.SetDepot(lineID, closestDepot);
                 }
                 if (ImprovedPublicTransportMod.Settings.ShowLineInfo)
                 {
                     WorldInfoPanel.Show <PublicTransportWorldInfoPanel>(position, new InstanceID()
                     {
                         TransportLine = lineID
                     });
                 }
             }
         }
     }
     else
     {
         if (this.SimulationLineCount >= this.KnownLineCount)
         {
             return;
         }
         Array16 <TransportLine> lines = Singleton <TransportManager> .instance.m_lines;
         for (ushort index = 0; (uint)index < lines.m_size; ++index)
         {
             if (!LineWatcher.IsValid(ref lines.m_buffer[(int)index]))
             {
                 this._knownLines.Remove(index);
             }
         }
     }
 }