コード例 #1
0
 public bool getFromNeighbour()
 {
     if (neighbor != null)
     {
         MaterialHolder neighbourPresent = neighbor.takeMaterial(materialHolded, grabCount);
         addMaterial(neighbourPresent.getMaterialId(), neighbourPresent.getCount());
         return(true);
     }
     return(false);
 }
コード例 #2
0
 public bool addMaterial(MaterialId id, int count)
 {
     if (materialHolded == null)
     {
         materialHolded = new MaterialHolder(id, count);
     }
     else if (materialHolded.getMaterialId() == id)
     {
         materialHolded.Add(count);
         return(true);
     }
     return(false);
 }
コード例 #3
0
 public MaterialHolder takeMaterial(MaterialHolder holded, int grabCount)
 {
     if (materialHolded != null && (holded == null || holded.getMaterialId() == materialHolded.getMaterialId()))
     {
         int        maxPossible = materialHolded.Substract(grabCount);
         MaterialId mid         = materialHolded.getMaterialId();
         if (maxPossible != grabCount)
         {
             materialHolded = null;
         }
         return(new MaterialHolder(mid, maxPossible));
     }
     return(null);
 }
コード例 #4
0
 public Output(int ref_x, int ref_y, Output neighbor, direction faceDirection, List <MaterialId> materialsFilter, MaterialHolder materialHolded, putState state)
 {
     this.ref_x           = ref_x;
     this.ref_y           = ref_y;
     this.neighbor        = neighbor;
     put                  = putDirection.output;
     this.faceDirection   = faceDirection;
     this.materialsFilter = materialsFilter;
     this.materialHolded  = materialHolded;
     this.state           = state;
 }