private void Refresh(float dt)
    {
        UtilityNetworkManager <ElectricalUtilityNetwork, Wire> electricalConduitSystem = Game.Instance.electricalConduitSystem;

        if (electricalConduitSystem.IsDirty || dirty)
        {
            electricalConduitSystem.Update();
            IList <UtilityNetwork> networks = electricalConduitSystem.GetNetworks();
            while (this.circuitInfo.Count < networks.Count)
            {
                CircuitInfo circuitInfo = default(CircuitInfo);
                circuitInfo.generators         = new List <Generator>();
                circuitInfo.consumers          = new List <IEnergyConsumer>();
                circuitInfo.batteries          = new List <Battery>();
                circuitInfo.inputTransformers  = new List <Battery>();
                circuitInfo.outputTransformers = new List <Generator>();
                CircuitInfo item = circuitInfo;
                item.bridgeGroups = new List <WireUtilityNetworkLink> [5];
                for (int i = 0; i < item.bridgeGroups.Length; i++)
                {
                    item.bridgeGroups[i] = new List <WireUtilityNetworkLink>();
                }
                this.circuitInfo.Add(item);
            }
            Rebuild();
        }
    }
示例#2
0
 private void Refresh(float dt)
 {
     if (conduitSystem.IsDirty)
     {
         conduitSystem.Update();
         PropagateSignals(true);
         elapsedTime = 0f;
     }
     else if (conduitSystem.GetNetworks().Count > 0 && (UnityEngine.Object)SpeedControlScreen.Instance != (UnityEngine.Object)null && !SpeedControlScreen.Instance.IsPaused)
     {
         elapsedTime += dt;
         while (elapsedTime > ClockTickInterval)
         {
             elapsedTime -= ClockTickInterval;
             PropagateSignals(false);
         }
     }
 }