Esempio n. 1
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);
    }
Esempio n. 2
0
    //! Unloads the pipette into a proper vessel
    // The vessel being the same reagent used to get the volume */

    /*public void UnfillPipette(bool reagent) { //BasicallyDone
     *
     *      volumeHeld = 0.0f;
     *      reagentInPipette = null;
     *
     *      CursorManager.SetMouseState (MouseState.ms_default);
     *      CursorManager.SetCursorToDefault();
     * }*/


    /* END OF GRADUATED PIPETTE */

    public void FillVolumetricPipette(Glassware glassware)      //Ok
    {
        if (glassware.currentVolume < this.maxVolume)           //Case volume on glass < pipette's max volume
        {
            this.volumeHeld  = glassware.currentVolume;
            reagentInPipette = (Compound)(glassware.content as Compound).Clone(volumeHeld);
            glassware.RemoveLiquid(glassware.currentVolume);
        }
        else
        {
            this.volumeHeld       = this.maxVolume;
            this.reagentInPipette = (Compound)(glassware.content as Compound).Clone(volumeHeld);
            glassware.RemoveLiquid(volumeHeld);
        }
        if (volumeHeld > 0.0f)
        {
            CursorManager.SetMouseState(MouseState.ms_filledPipette);
            CursorManager.SetNewCursor(filledPipette_CursorTexture, hotSpot);
            GameObject.Find("GameController").GetComponent <GameController>().GetCurrentState().GetComponent <WorkBench>().cannotEndState = true;
        }
    }
Esempio n. 3
0
    /// <summary>
    /// Returns the volume in the bucket to the glassware to be analyzed.
    /// </summary>
    public void GiveBackReagent()
    {
        if ((cubeta.content as Compound).Formula == (workbench.positionGlass [0].GetComponentInChildren <Glassware> ().content as Compound).Formula)
        {
            float    value  = (cubeta.content as Compound).Volume;
            Compound sample = (cubeta.content as Compound).Clone(value) as Compound;
            cubeta.RemoveLiquid(value);

            if (workbench.positionGlass [0].childCount > 0)
            {
                workbench.positionGlass [0].GetComponentInChildren <Glassware> ().IncomingReagent(sample, value);
            }
        }
        else
        {
            //Send alert
        }
    }
Esempio n. 4
0
    //! Use the pipette to hold the selected volume.
    public void FillGraduatedPipette()       //ReagentPot OK | Glassware Ok
    {
        if (volumeSelected > 0.0f)
        {
            volumeHeld = Random.Range(volumeSelected - graduatedError, volumeSelected + graduatedError);
        }
        if (interactingGlassware != null)
        {
            if (volumeSelected > 0.0f)
            {
                /*if (!(lastItemSelected.GetComponent<Glassware> () == null)) //Only removes from the last selected object if it's a glassware
                 * lastItemSelected.GetComponent<Glassware>().RemoveLiquid (amountSelectedPipeta);*/
                CursorManager.SetMouseState(MouseState.ms_filledPipette);                 //pipetaReagentCursor.CursorEnter ();
                CursorManager.SetNewCursor(filledPipette_CursorTexture, hotSpot);

                GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState().GetComponent <WorkBench> ().cannotEndState = true;

                reagentInPipette = (Compound)(interactingGlassware.content as Compound).Clone(volumeHeld);

                interactingGlassware.RemoveLiquid(volumeHeld);
            }
        }
        else if (interactingReagent != null)
        {
            if (volumeSelected > 0.0f)
            {
                CursorManager.SetMouseState(MouseState.ms_filledPipette);                 //pipetaReagentCursor.CursorEnter ();
                CursorManager.SetNewCursor(filledPipette_CursorTexture, hotSpot);

                GameObject.Find("GameController").GetComponent <GameController> ().GetCurrentState().GetComponent <WorkBench> ().cannotEndState = true;
                reagentInPipette = (Compound)CompoundFactory.GetInstance().GetCupboardCompound((interactingReagent.Name)).Clone(volumeHeld);
            }
        }

        //volumeHeld = volumeSelected;
        CloseInteractionBox();
    }