public void UnfillVolumetricPipette(Glassware glassware) //Ok { if ((glassware.maxVolume - glassware.GetLiquidVolume()) < this.maxVolume) //Case volume on pipette > volume available { float previousVolume = glassware.GetLiquidVolume(); if (glassware.IncomingReagent(this.reagentInPipette, glassware.maxVolume - glassware.GetLiquidVolume())) //If poured, takes out the volume from the pipette { this.volumeHeld -= (glassware.maxVolume - previousVolume); } } else //Case volume available in glass > volume on pipette { if (glassware.IncomingReagent(reagentInPipette, volumeHeld)) { volumeHeld = 0.0f; } } if (volumeHeld == 0.0f) { reagentInPipette = null; CursorManager.SetMouseState(MouseState.ms_default); CursorManager.SetCursorToDefault(); GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState().GetComponent <WorkBench> ().cannotEndState = false; } else { CursorManager.SetMouseState(MouseState.ms_filledPipette); CursorManager.SetNewCursor(filledPipette_CursorTexture, hotSpot); } }
//! Unloads the pipette into a proper vessel // Called when the filled pipette clicks on a valid vessel for the reagent. public void UnfillGraduatedPipette() //ReagentPot Ok | Glassware Ok { if (u_volumeSelected > 0.0f) //If some liquid is selected, the amount is poured into the glassware { bool ok; if (interactingGlassware != null) { if (u_volumeSelected <= (interactingGlassware.maxVolume - interactingGlassware.GetLiquidVolume())) // //interactingGlassware.PourLiquid (volumeHeld, volumeHeld * reagentInPipette.Density, reagentInPipette); { ok = interactingGlassware.IncomingReagent(reagentInPipette, u_volumeSelected); } else { /*interactingGlassware.PourLiquid ((interactingGlassware.maxVolume - interactingGlassware.currentVolume), * (interactingGlassware.maxVolume - interactingGlassware.currentVolume) * reagentInPipette.Density, reagentInPipette);*/ ok = interactingGlassware.IncomingReagent(reagentInPipette, interactingGlassware.maxVolume - interactingGlassware.GetLiquidVolume()); } if (ok) { volumeHeld -= u_volumeSelected; } } else if (interactingReagent != null) { volumeHeld -= u_volumeSelected; } } if (volumeHeld <= graduatedError) //If all the liquid is taken out of the pipette, the pipette is put down and come back to a default state { volumeHeld = 0.0f; reagentInPipette = null; CursorManager.SetMouseState(MouseState.ms_default); CursorManager.SetCursorToDefault(); GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState().GetComponent <WorkBench> ().cannotEndState = false; } else { CursorManager.SetMouseState(MouseState.ms_filledPipette); CursorManager.SetNewCursor(filledPipette_CursorTexture, hotSpot); } u_volumeSelected = 0.0f; interactingGlassware = null; interactingReagent = null; CloseInteractionBox(); }
//! Pours the water into the vessel (mostly glasswares). public void PourWater() //BasicallyDone { if (interactingGlassware.precisionGlass) { interactingGlassware.IncomingReagent(Water, interactingGlassware.maxVolume - interactingGlassware.GetLiquidVolume()); } else { if (volumeSelected > 0.0f) { //interactingGlassware.PourLiquid(volumeSelected, volumeSelected * Water.Density, Water); interactingGlassware.IncomingReagent(Water, volumeSelected); } } CloseInteractionBox(); }