public void TransferBufferToContainer(Reagent reagent, float amount) { ReagentMix tempTransfer = GetBufferMix(); //Container never gets swapped without clearing buffer, so we can assume there's space in container tempTransfer.Remove(reagent, amount); Container.CurrentReagentMix.Add(reagent, amount); TransferMixToBuffer(tempTransfer); UpdateGui(); }
public void RemoveFromBuffer(Reagent reagent, float amount) { ReagentMix tempTransfer = GetBufferMix(); //one removal, no math tempTransfer.Remove(reagent, amount); //part two of transfer: fill Buffer from tempTransfer Mix TransferMixToBuffer(tempTransfer); UpdateGui(); }
public void RemoveFromBuffer(Reagent reagent, float amount) { ReagentMix tempTransfer = GetBufferMix(); //one removal, no math tempTransfer.Remove(reagent, amount); //remove listing if empty if (tempTransfer.reagents[reagent] <= 0) { tempTransfer.reagentKeys.Remove(reagent); } //part two of transfer: fill Buffer from tempTransfer Mix TransferMixToBuffer(tempTransfer); UpdateGui(); }
public void TransferBufferToContainer(Reagent reagent, float amount) { ReagentMix tempTransfer = GetBufferMix(); //Container never gets swapped without clearing buffer, so we can assume there's space in container tempTransfer.Remove(reagent, amount); Container.CurrentReagentMix.Add(reagent, amount); //remove listing if empty if (tempTransfer.reagents[reagent] <= 0) { lock (tempTransfer.reagents) { tempTransfer.reagents.m_dict.Remove(reagent); } } TransferMixToBuffer(tempTransfer); UpdateGui(); }