コード例 #1
0
        public CircuitProcessor(PluginTrace pluginTrace, CircuitHandler circuitHandler, ObjectMeasureData senderMeasureData)
        {
            Contract.Requires<ArgumentNullException>(pluginTrace != null);
              Contract.Requires<ArgumentNullException>(circuitHandler != null);

              this.PluginTrace = pluginTrace;
              this.CircuitHandler = circuitHandler;
              this.SenderMeasureData = senderMeasureData;

              // Is sender directly wired?
              bool isSenderWired;
              if (this.SenderMeasureData.BlockType == BlockType.DoorOpened) {
            isSenderWired = false;
            for (int y = this.SenderMeasureData.OriginTileLocation.Y; y < this.SenderMeasureData.OriginTileLocation.Y + this.SenderMeasureData.Size.Y; y++) {
              if (TerrariaUtils.Tiles[this.SenderMeasureData.OriginTileLocation.X, y].HasWire()) {
            isSenderWired = true;
            break;
              }
            }
              } else {
            isSenderWired = TerrariaUtils.Tiles.IsObjectWired(this.SenderMeasureData);
              }

              this.result = new CircuitProcessingResult {
            IsAdvancedCircuit = !isSenderWired,
            SenderLocation = this.SenderMeasureData.OriginTileLocation
              };
        }
コード例 #2
0
 public CircuitProcessor(PluginTrace pluginTrace, CircuitHandler circuitHandler, DPoint senderLocation)
     : this(pluginTrace, circuitHandler, CircuitProcessor.CircuitProcessorCtor_MeasureSender(senderLocation))
 {
     Contract.Requires<ArgumentNullException>(pluginTrace != null);
       Contract.Requires<ArgumentNullException>(circuitHandler != null);
 }