Example #1
0
        public override bool DoMix(List <SimulationMixableBehavior> otherMixables, DropZoneObjectHandler dropZoneObject, DraggableObjectBehavior draggedObject = null)
        {
            if (draggedObject != null)
            {
                if (draggedObject.MixtureItem.GetType() == typeof(TestTube))
                {
                    // mixing some test tubes
                    if (!hasTestTube)
                    {
                        hasTestTube = true;
                        this.icon   = Resources.Load <Sprite>("Simulation/Lab4/Equipments/RackTube");
                        dropZoneObject.SetIcon(this.icon);
                        draggedObject.SetRemoveOnEnd();

                        return(true);
                    }
                    else
                    {
                        ModalPanel.Instance.ShowModalOK("Has Test Tube", "This rack already have test tubes");
                    }
                }
                else if (hasTestTube)
                {
                    if (draggedObject.MixtureItem.GetType() == typeof(AmmoniumHydroxide) || draggedObject.MixtureItem.GetType() == typeof(HydrochloricAcid))
                    {
                        if (otherMixables.Find(m => m.GetType() == typeof(HydrochloricAcid) && m.GetType() == typeof(AmmoniumHydroxide)) == null)
                        {
                            draggedObject.SetRemoveOnEnd();
                            return(true);
                        }
                        else
                        {
                            ModalPanel.Instance.ShowModalOK("Single Sample", "You can only put one sample for this test tube");
                        }
                    }
                }
                else
                {
                    ModalPanel.Instance.ShowModalOK("No Test Tube", "This item cannot be added. Try adding a test tube first");
                }
            }

            return(false);
        }
Example #2
0
        public override bool DoMix(List <SimulationMixableBehavior> otherMixables, DropZoneObjectHandler dropZoneObject, DraggableObjectBehavior draggedObject = null)
        {
            if (draggedObject != null)
            {
                if (LabOneManager.ActivePart == LabOneManager.LabPart.PartA)
                {
                    if (draggedObject.MixtureItem.GetType() == typeof(Water))
                    {
                        if (otherMixables.Find(m => m.GetType() == draggedObject.MixtureItem.GetType()) == null)
                        {
                            // first time water
                            ImageAnimationManager.Instance.ShowAnimation(16);

                            draggedObject.SetRemoveOnEnd();
                            return(true);
                        }
                        else
                        {
                            ModalPanel.Instance.ShowModalOK("Duplicate", "Only one of this item can be added");
                        }
                    }
                    else if (draggedObject.MixtureItem.GetType() == typeof(Sand))
                    {
                        if ((otherMixables.Find(m => m.GetType() == typeof(Water)) != null))
                        {
                            if (otherMixables.Find(m => m.GetType() == typeof(Chalk)) == null)
                            {
                                if (otherMixables.Find(m => m.GetType() == draggedObject.MixtureItem.GetType()) == null)
                                {
                                    // first time water
                                    ImageAnimationManager.Instance.ShowAnimation(12);

                                    draggedObject.SetRemoveOnEnd();
                                    return(true);
                                }
                                else
                                {
                                    ModalPanel.Instance.ShowModalOK("Duplicate", "Only one of this item can be added");
                                }
                            }
                            else
                            {
                                ModalPanel.Instance.ShowModalOK("Limit", "Only one compound can be mixed with water");
                            }
                        }
                        else
                        {
                            ModalPanel.Instance.ShowModalOK("No Water", "Water not yet added. Please add water first on the beaker");
                        }
                    }
                    else if (draggedObject.MixtureItem.GetType() == typeof(Chalk))
                    {
                        if ((otherMixables.Find(m => m.GetType() == typeof(Water)) != null))
                        {
                            if (otherMixables.Find(m => m.GetType() == typeof(Sand)) == null)
                            {
                                if (otherMixables.Find(m => m.GetType() == draggedObject.MixtureItem.GetType()) == null)
                                {
                                    // first time water
                                    draggedObject.SetRemoveOnEnd();
                                    return(true);
                                }
                                else
                                {
                                    ModalPanel.Instance.ShowModalOK("Duplicate", "Only one of this item can be added");
                                }
                            }
                            else
                            {
                                ModalPanel.Instance.ShowModalOK("Limit", "Only one compound can be mixed with water");
                            }
                        }
                        else
                        {
                            ModalPanel.Instance.ShowModalOK("No Water", "Water not yet added. Please add water first on the beaker");
                        }
                    }
                    else if (draggedObject.MixtureItem.GetType() == typeof(Beaker))
                    {
                        if (otherMixables.Find(m => m.GetType() == typeof(Water)) != null)
                        {
                            if (otherMixables.Find(m => m.GetType() == typeof(Sand)) != null)
                            {
                                ModalPanel.Instance.ShowModalOK("Result", "The supernatant liquid is clear");
                            }
                            else if (otherMixables.Find(m => m.GetType() == typeof(Chalk)) != null)
                            {
                                ModalPanel.Instance.ShowModalOK("Result", "The supernatant liquid is opaque");
                            }
                            else
                            {
                                ModalPanel.Instance.ShowModalOK("Result", "This is just water");
                            }
                        }
                        else
                        {
                            ModalPanel.Instance.ShowModalOK("No liquid", "No liquid to transfer between beakers");
                        }
                    }
                }
            }

            return(false);
        }
Example #3
0
        public override bool DoMix(List <SimulationMixableBehavior> otherMixables, DropZoneObjectHandler dropZoneObject, DraggableObjectBehavior draggedObject = null)
        {
            if (draggedObject != null)
            {
                if (draggedObject.MixtureItem.GetType() == typeof(MicroTestTube))
                {
                    // mixing some test tubes
                    if (!hasTestTube)
                    {
                        hasTestTube = true;
                        this.icon   = Resources.Load <Sprite>("Simulation/Lab5/Equipments/Rack-Tube");
                        dropZoneObject.SetIcon(this.icon);
                        draggedObject.SetRemoveOnEnd();

                        return(true);
                    }
                    else
                    {
                        ShowNoDuplicateError(draggedObject.MixtureItem);
                    }
                }
                else if (hasTestTube)
                {
                    // do performance stuffs
                    if (draggedObject.MixtureItem.GetType() == typeof(Water) || draggedObject.MixtureItem.GetType() == typeof(Kerosene))
                    {
                        if (otherMixables.Find(m => m.itemName == draggedObject.MixtureItem.itemName) == null)
                        {
                            // first time water
                            draggedObject.SetRemoveOnEnd();
                            return(true);
                        }
                        else
                        {
                            ShowNoDuplicateError(draggedObject.MixtureItem);
                        }
                    }
                    else if (draggedObject.MixtureItem.GetType() == typeof(SodiumChloride) ||
                             draggedObject.MixtureItem.GetType() == typeof(Naphthalene) ||
                             draggedObject.MixtureItem.GetType() == typeof(SodiumChloride) ||
                             draggedObject.MixtureItem.GetType() == typeof(EthylAlcohol) ||
                             draggedObject.MixtureItem.GetType() == typeof(CoconutOil))
                    {
                        if (otherMixables.Count(m => m.itemName == draggedObject.MixtureItem.itemName) < 2)
                        {
                            // first time nacl
                            draggedObject.SetRemoveOnEnd();
                            return(true);
                        }
                        else
                        {
                            ModalPanel.Instance.ShowModalOK("Max Amount", "Only a maximum of two of this material can be added");
                        }
                    }
                }
                else
                {
                    ModalPanel.Instance.ShowModalOK("Test Tube Required", "Need a test tube to put this material. Please add a test tube first.");
                }
            }
            else
            {
                if (LabFiveManager.instance.ActivePart == LabFiveManager.LabPart.PartA)
                {
                    if (otherMixables.Count(m => m.GetType() == typeof(SodiumChloride)) == 2 &&
                        otherMixables.Count(m => m.GetType() == typeof(Naphthalene)) == 2 &&
                        otherMixables.Find(m => m.GetType() == typeof(Water)) != null &&
                        otherMixables.Find(m => m.GetType() == typeof(Kerosene)) != null)
                    {
                        ModalPanel.Instance.ShowModalOK("Result", "Sodium chloride dissolved in water but not in kerosene. Naphthalene dissolved in kerosene but not in water. Proceeding to Part B", () =>
                        {
                            LabFiveManager.instance.MoveToPartB();
                        });
                    }
                    else
                    {
                        ModalPanel.Instance.ShowModalOK("Incomplete Materials", "Not enough materials to stir. Please add all materials required.");
                    }
                }
                else
                {
                    if (otherMixables.Count(m => m.GetType() == typeof(EthylAlcohol)) == 2 &&
                        otherMixables.Count(m => m.GetType() == typeof(CoconutOil)) == 2 &&
                        otherMixables.Find(m => m.GetType() == typeof(Water)) != null &&
                        otherMixables.Find(m => m.GetType() == typeof(Kerosene)) != null)
                    {
                        ModalPanel.Instance.ShowModalOK("Result", "Ethyl Alcohol dissolved in water but not in kerosene. Coconut Oil dissolved in kerosene but not in water.", () =>
                        {
                            LabFiveManager.instance.Finish();
                        });
                    }
                    else
                    {
                        ModalPanel.Instance.ShowModalOK("Incomplete Materials", "Not enough materials to stir. Please add all materials required.");
                    }
                }
            }

            return(false);
        }
Example #4
0
        public override bool DoMix(List <SimulationMixableBehavior> otherMixables, DropZoneObjectHandler dropZoneObject, DraggableObjectBehavior draggedObject = null)
        {
            if (draggedObject != null)
            {
                if (draggedObject.MixtureItem.GetType() == typeof(Coins))
                {
                    if (otherMixables.Find(m => m.GetType() == typeof(Water)) != null)
                    {
                        if (otherMixables.Find(m => m.GetType() == draggedObject.MixtureItem.GetType()) == null)
                        {
                            // first time water
                            ImageAnimationManager.Instance.ShowAnimation(83);
                            draggedObject.SetRemoveOnEnd();
                            return(true);
                        }
                        else
                        {
                            ModalPanel.Instance.ShowModalOK("Duplicate Item", "You can only put one kind of this item inside the cylinder");
                        }
                    }
                    else
                    {
                        ModalPanel.Instance.ShowModalOK("No Water", "Add water first before putting the coins");
                    }
                }
                else if (draggedObject.MixtureItem.GetType() == typeof(Water))
                {
                    if (otherMixables.Find(m => m.GetType() == draggedObject.MixtureItem.GetType()) == null)
                    {
                        // first time water
                        draggedObject.SetRemoveOnEnd();
                        return(true);
                    }
                    else
                    {
                        ModalPanel.Instance.ShowModalOK("Duplicate Item", "You can only put one kind of this item inside the cylinder");
                    }
                }
                else if (draggedObject.MixtureItem.GetType() == typeof(Thermometer))
                {
                    var w = otherMixables.Find(m => m.GetType() == typeof(Water));
                    if (w != null)
                    {
                        if ((w as Water).Volume == 50)
                        {
                            ImageAnimationManager.Instance.ShowAnimation(87);
                        }
                        else
                        {
                            ImageAnimationManager.Instance.ShowAnimation(88);
                        }
                        ModalPanel.Instance.ShowModalOK("Temperature", "The temperature is 25.0C");
                    }
                    else
                    {
                        ModalPanel.Instance.ShowModalOK("Temperature", "Nothing to measure here");
                    }
                }
            }
            else
            {
                if (otherMixables.Find(m => m.GetType() == typeof(Water)) == null)
                {
                    ModalPanel.Instance.ShowModalOK("Current Volume", "There is no water");
                }
                else if (otherMixables.Find(m => m.GetType() == typeof(Coins)) == null)
                {
                    ModalPanel.Instance.ShowModalOK("Current Volume", "The water is currently at 50 mL");
                }
                else
                {
                    ModalPanel.Instance.ShowModalOK("Current Volume", "The water is currently at 59 mL");
                }
            }

            return(false);
        }