Ejemplo n.º 1
0
 public bool TransferTo(StorageModule destination, uint type, uint amount)
 {
     // Transfer amount m^3 of type materials from here to destination.
     return destination.TransferFrom(this, type, amount);
 }
Ejemplo n.º 2
0
 public bool TransferFrom(StorageModule source, uint type, uint amount)
 {
     // Transfer amount m^3 of type materials from source to here.
     if (this.QuerySpaceLeft (type) >= amount && source.QueryAmountStored (amount) >= amount) {
         // We have enough space and the source has enough of the resource; do the transfer.
         this.Store (type, amount);
         source.Withdraw (type, amount);
         return true;
     } else {
         return false;
     }
 }