Ejemplo n.º 1
0
        private void UpdateLogicCircuit()
        {
            var wire = Grid.Objects[building.GetCell(), (int)ObjectLayer.LogicWire];

            this.GetComponent <LogicPorts>().SendSignal(LogicSwitch.PORT_ID, this.switchedOn
                ? (int)Math.Pow(2, LogicWire.GetBitDepthAsInt(wire?.GetComponent <LogicWire>()?.GetMaxBitRating() ?? LogicWire.BitDepth.OneBit)) - 1
                : 0);
        }
 public override void Reset(UtilityNetworkGridNode[] grid)
 {
     resetting     = true;
     previousValue = -1;
     outputValue   = 0;
     for (int i = 0; i < wires.Count; i++)
     {
         LogicWire logicWire = wires[i];
         if ((Object)logicWire != (Object)null)
         {
             int num = Grid.PosToCell(logicWire.transform.GetPosition());
             UtilityNetworkGridNode utilityNetworkGridNode = grid[num];
             utilityNetworkGridNode.networkIdx = -1;
             grid[num] = utilityNetworkGridNode;
         }
     }
     wires.Clear();
     senders.Clear();
     receivers.Clear();
     resetting = false;
 }