Exemplo n.º 1
0
    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);
        }
    }
Exemplo n.º 2
0
    //! 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();
    }
Exemplo n.º 3
0
 //! 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();
 }
Exemplo n.º 4
0
    /// <summary>
    /// Correctly prepares the glassware to be analyzed.
    /// </summary>
    /// <param name="glass">The glassware to be prepared.</param>
    public void PrepareGlassware(Glassware glass)
    {
        float    value  = Mathf.Min((glass.content as Compound).Volume, cubeta.maxVolume);
        Compound sample = (glass.content as Compound).Clone(value) as Compound;

        glass.RemoveLiquid(value);

        cubeta.IncomingReagent(sample, value);
    }
Exemplo n.º 5
0
    //! Unloads the spatula into a proper vessel
    //  Called when the filled spatula clicks on a valid vessel for the reagent.
    //  In this overload, the vessel is a glassware
    public void UnfillSpatula(float volumeAvailable, Glassware glassware)
    {
        CloseInteractionBox();

        if (volumeAvailable > volumeHeld)
        {
            //glassware.InsertSolid (volumeHeld, volumeHeld * reagentInSpatula.Density, reagentInSpatula);
            glassware.IncomingReagent(reagentInSpatula, volumeHeld);
            GameObject.Find("GameController").GetComponent <GameController>().GetCurrentState().GetComponent <WorkBench>().cannotEndState = false;

            CursorManager.SetMouseState(MouseState.ms_default);
            CursorManager.SetCursorToDefault();

            volumeHeld       = 0.0f;
            reagentInSpatula = null;
        }
        else
        {
            //glassware.InsertSolid (volumeAvailable, volumeAvailable * reagentInSpatula.Density, reagentInSpatula);
            glassware.IncomingReagent(reagentInSpatula, volumeAvailable);
            //TODO: Show something to the player?

            volumeHeld -= volumeAvailable;
        }

        /*if (realVolumeSelected > 0) {
         *      interactingGlassware.InsertSolid (realVolumeSelected, realVolumeSelected * reagentInSpatula.density, reagentInSpatula);
         *      spatulasInUse -= realVolumeSelected;
         * }
         * if (spatulasInUse <= realVolumeSelected) {
         *      spatulasInUse = 0;
         *      reagentInSpatula = null;
         *
         *      CursorManager.SetMouseState (MouseState.ms_default);
         *      CursorManager.SetCursorToDefault();
         * }
         *
         * realVolumeSelected = 0.0f;
         * interactingGlassware = null;*/
    }