private void OnTriggerStay(Collider other)
    {
        if (_areParticlesInitiated == false &&
            (other.gameObject.name == "Red Substance Beaker(Clone)" || other.gameObject.name == "Orange Substance Beaker(Clone)" || other.gameObject.name == "Yellow Substance Beaker(Clone)"))
        {
            Invoke("GameOver", 3f);
            GameObject deadlyParticles = Instantiate(GreenYellowParticles, gameObject.transform);
            deadlyParticles.transform.Rotate(180, 0, 0);
            _areParticlesInitiated = true;
        }

        if (_isSmokeInitiated == false &&
            (other.gameObject.name == "Blue Substance Beaker(Clone)" || other.gameObject.name == "Purple Substance Beaker(Clone)"))
        {
            _currentSmokeParticles = Instantiate(SmokeParticles, gameObject.transform);
            _currentSmokeParticles.transform.Rotate(180, 0, 0);
            _isSmokeInitiated = true;
        }

        if (other.CompareTag("Beaker"))
        {
            Destroy(other.transform.GetChild(0).gameObject);

            if (other.transform.gameObject.transform.GetChild(0).name != "Smelly Waste(Clone)")
            {
                ProfileSystemController.TimesAnIncidentWasCaused++;
                ProfileSystemController.UpdateProfileData();
            }

            if (other.GetComponent <MeshFilter>().mesh.name == "mod_laboratorium_flask_T2 Instance")
            {
                other.name = "Round Empty Beaker";
            }
            else if (other.GetComponent <MeshFilter>().mesh.name == "mod_laboratorium_flask Instance")
            {
                other.name = "Empty Beaker";
            }
            else if (other.GetComponent <MeshFilter>().mesh.name == "mod_laboratory_beaker Instance")
            {
                other.name = "Big Empty Beaker";
            }
            else if (other.GetComponent <MeshFilter>().mesh.name == "laboratory_testTube_tube Instance")
            {
                other.name = "Small Empty Beaker";
            }
            gameObject.tag = "Untagged";
        }
        if (other.CompareTag("Dropper"))
        {
            Destroy(other.transform.GetChild(0).gameObject);
            other.name = "Empty Dropper";
        }
    }
Exemplo n.º 2
0
    private void GameOver()
    {
        HandinController._enableTransitioner = true;

        HandinController.IsObjectiveHandedIn = true;
        ProfileSystemController.TimesAGuidelineIsMissed++;
        ProfileSystemController.PlayingALevel = false;
        ProfileSystemController.UpdateProfileData();

        ObjectivesSelector.CanWearEquipment = false;
        PointerController.IsWearingCoat     = false;
        PointerController.IsWearingGlasses  = false;
        PointerController.IsWearingGloves   = false;

        PointerController.IsHoldingItem = false;
        PointerController.CurrentlyHoldingObjectForBeakers = null;
        _player.GetComponentInChildren <PointerController>().ReturnEquipment();

        _labEquipment = GameObject.FindGameObjectWithTag("Lab Equipment");
        Destroy(_currentParticles);
        Destroy(_labEquipment);
    }
    private void GameOver()
    {
        HandinController._enableTransitioner = true;

        Vector3 newPlayerPos = _player.transform.position;

        newPlayerPos = _lobbyPoint.transform.position;
        _player.transform.position = newPlayerPos;

        HandinController.IsObjectiveHandedIn = true;
        ProfileSystemController.TimesAGuidelineIsMissed++;
        ProfileSystemController.PlayingALevel = false;
        ProfileSystemController.UpdateProfileData();

        ObjectivesSelector.CanWearEquipment = false;
        PointerController.IsWearingCoat     = false;
        PointerController.IsWearingGlasses  = false;
        PointerController.IsWearingGloves   = false;

        PointerController.IsHoldingItem = false;
        PointerController.CurrentlyHoldingObjectForBeakers = null;
        _player.GetComponentInChildren <PointerController>().ReturnEquipment();
        Destroy(_labEquipment);
    }
Exemplo n.º 4
0
    public void HandInObjective()
    {
        // Resetting the objective report string before we append text to it!
        _objectiveReport = "";
        // We are checking for every task in the objective and depending
        // on its outcome, we update the final mission report string and then
        // set it as the text parameter in the canvas text object.
        _objectiveReport += "Objective report:\n";

        GameObject[] existingDirtyBeakers = GameObject.FindGameObjectsWithTag("Dirty Beaker");
        GameObject[] existingSmellyWaste  = GameObject.FindGameObjectsWithTag("Smelly Waste");

        if (ObjectivesSelector.CurrentObjective == "Use Water Bottle")
        {
            if (ObjectivesSelector.PickedUpWaterBottle == false)
            {
                _objectiveReport += "Did not pick up a water bottle!\n";
            }
            else
            {
                _objectiveReport += "DONE: Pick up a water bottle!\n";
            }

            if (ObjectivesSelector.PlacedBackWaterBottle == false)
            {
                _objectiveReport += "Did not place back a water bottle!\n";
            }
            else
            {
                _objectiveReport += "DONE: Place back a water bottle!\n";
            }

            if (PointerController.IsWearingCoat == false)
            {
                _objectiveReport += "You are not wearing a lab coat!\n";
            }
            else
            {
                _objectiveReport += "DONE: Wore a lab coat\n";
            }

            if (existingDirtyBeakers.Length > 0)
            {
                _objectiveReport += "You've left dirty beakers in the lab!\n";
            }
            else
            {
                _objectiveReport += "You've cleaned the beakers in the lab!\n";
            }

            if (existingSmellyWaste.Length > 0)
            {
                _objectiveReport += "You've left smelly waste in the lab!\n";
            }
            else
            {
                _objectiveReport += "You've cleaned the smelly waste in the lab!\n";
            }


            // Calculating the pass or fail of an objective and giving the result of it.
            if (ObjectivesSelector.PickedUpWaterBottle &&
                ObjectivesSelector.PlacedBackWaterBottle &&
                PointerController.IsWearingCoat &&
                existingDirtyBeakers.Length <= 0 &&
                existingSmellyWaste.Length <= 0)
            {
                ProfileSystemController.TimesForLevelMixColors.Add(ProfileSystemController.CurrentLevelSeconds);
                //Debug.Log(ProfileSystemController.CurrentLevelSeconds);
                ProfileSystemController.CurrentLevelSeconds = 0;

                _objectiveReport  = "Objective complete!\n";
                _objectiveReport += "Returning to lobby in 3...";
                Invoke("CompleteHandIn", 4f);
            }
            else
            {
                ProfileSystemController.TimesAGuidelineIsMissed++;
                ProfileSystemController.UpdateProfileData();

                _objectiveReport += "< Failed >";
            }

            TextObject.GetComponent <Text>().text = _objectiveReport;
        }

        if (ObjectivesSelector.CurrentObjective == "Use Teleporter")
        {
            if (ObjectivesSelector.UsedTeleporter == false)
            {
                _objectiveReport += "Did not use a teleporter!\n";
            }

            if (existingDirtyBeakers.Length > 0)
            {
                _objectiveReport += "You've left dirty beakers in the lab!\n";
            }
            else
            {
                _objectiveReport += "You've cleaned the beakers in the lab!\n";
            }

            if (existingDirtyBeakers.Length > 0)
            {
                _objectiveReport += "You've left dirty beakers in the lab!\n";
            }
            else
            {
                _objectiveReport += "You've cleaned the smelly waste in the lab!\n";
            }

            // Calculating the pass or fail of an objective and giving the result of it.
            if (ObjectivesSelector.UsedTeleporter &&
                existingDirtyBeakers.Length <= 0 &&
                existingSmellyWaste.Length <= 0)
            {
                Invoke("CompleteHandIn", 4f);
            }
            else
            {
                _objectiveReport += "< Failed >";
            }

            TextObject.GetComponent <Text>().text = _objectiveReport;
        }

        if (ObjectivesSelector.CurrentObjective == "Mix Colors")
        {
            if (ObjectivesSelector.PourRedIntoTube == false)
            {
                _objectiveReport += "Did not pour red into tube!\n";
            }
            if (ObjectivesSelector.PourBlueIntoTube == false)
            {
                _objectiveReport += "Did not pour blue into tube!!\n";
            }
            if (ObjectivesSelector.PourYellowIntoTube == false)
            {
                _objectiveReport += "Did not pour yellow into tube!\n";
            }
            if (ObjectivesSelector.MixRedAndYellow == false)
            {
                _objectiveReport += "Did not mix red and yellow!\n";
            }
            if (ObjectivesSelector.MixRedAndBlue == false)
            {
                _objectiveReport += "Did not mix red and blue!\n";
            }
            if (ObjectivesSelector.MixBlueAndYellow == false)
            {
                _objectiveReport += "Did not mix blue and yellow!\n";
            }

            if (existingDirtyBeakers.Length > 0)
            {
                _objectiveReport += "You've left dirty beakers in the lab!\n";
            }
            else
            {
                _objectiveReport += "You've cleaned the beakers in the lab!\n";
            }

            if (existingDirtyBeakers.Length > 0)
            {
                _objectiveReport += "You've left dirty beakers in the lab!\n";
            }
            else
            {
                _objectiveReport += "You've cleaned the smelly waste in the lab!\n";
            }

            // Calculating the pass or fail of an objective and giving the result of it.
            if (ObjectivesSelector.PourRedIntoTube &&
                ObjectivesSelector.PourBlueIntoTube &&
                ObjectivesSelector.PourYellowIntoTube &&
                ObjectivesSelector.MixBlueAndYellow &&
                ObjectivesSelector.MixRedAndBlue &&
                ObjectivesSelector.MixRedAndYellow &&
                existingDirtyBeakers.Length <= 0 &&
                existingSmellyWaste.Length <= 0)
            {
                Invoke("CompleteHandIn", 4f);
            }
            else
            {
                ProfileSystemController.TimesAGuidelineIsMissed++;
                ProfileSystemController.UpdateProfileData();
                TextObject.GetComponent <Text>().text = string.Empty;

                _objectiveReport += "< Failed >";
            }

            TextObject.GetComponent <Text>().text = _objectiveReport;
        }
    }
Exemplo n.º 5
0
    void Update()
    {
        if (PointerController.IsHoldingItem)
        {
            _heldObject = PointerController.CurrentlyHoldingObjectForBeakers;

            if (_isObjectOverBeaker             //&&
                // Making sure the player has the item facing down when pouring.
                //(heldObject.transform.eulerAngles.x > 240 && heldObject.transform.eulerAngles.x < 300 ||
                //heldObject.transform.eulerAngles.x > 80 && heldObject.transform.eulerAngles.x < 90)
                )
            {
                // This helps signal the player that he can now spill the
                // substance he is holding into the empty beaker.
                if (_heldObject != null)
                {
                    _heldObjectColor = _heldObject.GetComponent <MeshRenderer>().material.color;
                }

                if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger) ||
                    Input.GetKeyDown(KeyCode.L))
                {
                    _centerEyeAudioSource.PlayOneShot(_centerEyeAudioSource.gameObject.GetComponent <CenterEyePointer>().WaterPourSound);

                    // If we are holding a dropper above a used beaker and the dropper is empty, then
                    // we can transfer liquid from the beaker to the dropper being held.
                    if ((gameObject.name == "Yellow Substance Beaker" ||
                         gameObject.name == "Red Substance Beaker" ||
                         gameObject.name == "Blue Substance Beaker" ||
                         gameObject.name == "Water Beaker" ||
                         gameObject.name == "Orange Substance Beaker" ||
                         gameObject.name == "Purple Substance Beaker" ||
                         gameObject.name == "Green Substance Beaker") &&
                        (_heldObject.name == "Dropper(Clone)" ||
                         _heldObject.name == "Empty Dropper" &&
                         _heldObject.transform.childCount <= 0))
                    {
                        // We instantiate the new liquid in the dropper instead of the beaker this time
                        // since we are *extracting*, not pouring liquids.
                        Instantiate(gameObject.transform.GetChild(0).gameObject,
                                    _heldObject.transform.position, new Quaternion(0, 0, 0, 0), _heldObject.transform);
                    }

                    // We instantiate the substance that the player is holding and we place it
                    // in the empty beaker.
                    if ((gameObject.name == "Empty Beaker" ||
                         gameObject.name == "Big Empty Beaker" ||
                         gameObject.name == "Round Empty Beaker" ||
                         gameObject.name == "Small Empty Beaker") && _heldObject.name == "Water(Clone)")
                    {
                        // This stores the new player data to his profile after a certain action changes a certain data value and needs to be updated.
                        ProfileSystemController.BeakersFilledWithWater++;
                        ProfileSystemController.UpdateProfileData();

                        Instantiate(WaterSubstance, transform.position, new Quaternion(0, 0, 0, 0), transform);
                        BeakerType = "Water";
                        // We also have to rename the current game object from empty because
                        // the beaker is no longer empty and instead has water.
                        gameObject.name = "Water Beaker";
                        gameObject.tag  = "Dirty Beaker";
                    }

                    if (gameObject.name == "Water Beaker" && _heldObject.name == "Red Substance(Clone)")
                    {
                        // We destroy the existing water and replace it with the
                        // substance the player is holding (red).
                        CreateSubstanceInBeaker(RedSubstance, "Red");
                        ObjectivesSelector.PourRedIntoTube = true;
                    }
                    else if (gameObject.name == "Water Beaker" && _heldObject.name == "Yellow Substance(Clone)")
                    {
                        CreateSubstanceInBeaker(YellowSubstance, "Yellow");
                        ObjectivesSelector.PourYellowIntoTube = true;
                    }
                    else if (gameObject.name == "Water Beaker" && _heldObject.name == "Blue Substance(Clone)")
                    {
                        CreateSubstanceInBeaker(BlueSubstance, "Blue");
                        ObjectivesSelector.PourBlueIntoTube = true;
                    }
                    else if ((gameObject.name == "Yellow Substance Beaker" &&
                              _heldObject.name == "Red Substance(Clone)") ||
                             (gameObject.name == "Red Substance Beaker" &&
                              _heldObject.name == "Yellow Substance(Clone)"))
                    {
                        ProfileSystemController.BeakersMixedToOrange++;
                        ProfileSystemController.UpdateProfileData();
                        CreateSubstanceInBeaker(OrangeSubstance, "Orange");
                        ObjectivesSelector.MixRedAndYellow = true;
                    }
                    else if ((gameObject.name == "Red Substance Beaker" &&
                              _heldObject.name == "Blue Substance(Clone)") ||
                             (gameObject.name == "Blue Substance Beaker" &&
                              _heldObject.name == "Red Substance(Clone)"))
                    {
                        ProfileSystemController.BeakersMixedToPurple++;
                        ProfileSystemController.UpdateProfileData();
                        CreateSubstanceInBeaker(PurpleSubstance, "Purple");
                        ObjectivesSelector.MixRedAndBlue = true;
                    }
                    else if ((gameObject.name == "Blue Substance Beaker" &&
                              _heldObject.name == "Yellow Substance(Clone)") ||
                             (gameObject.name == "Yellow Substance Beaker" &&
                              _heldObject.name == "Blue Substance(Clone)"))
                    {
                        ProfileSystemController.BeakersMixedToGreen++;
                        ProfileSystemController.UpdateProfileData();
                        CreateSubstanceInBeaker(GreenSubstance, "Green");
                        ObjectivesSelector.MixBlueAndYellow = true;
                    }
                }
            }
            else
            {
                if (_heldObject != null)
                {
                    _heldObjectColor = _heldObject.GetComponent <MeshRenderer>().material.color;
                }
            }
        }
    }
Exemplo n.º 6
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Beaker" || other.tag == "Dropper")
        {
            // **************************************
            // Warm colors trash bin effects
            if (AreParticlesInitiated == false && (BinType == "Warm" && other.gameObject.name == "Blue Substance Beaker(Clone)" || other.gameObject.name == "Purple Substance Beaker(Clone)"))
            {
                _currentParticles = Instantiate(FireParticles, gameObject.transform);

                // We check if the right beaker's liquid is being thrown away
                Destroy(other.transform.GetChild(0).gameObject);

                GameObject leftOvers = Instantiate(Leftovers,
                                                   other.transform.position,
                                                   Quaternion.identity,
                                                   other.transform);
                Leftovers.tag = "Smelly Waste";

                if (other.GetComponent <MeshFilter>().mesh.name == "laboratory_testTube_tube Instance")
                {
                    Vector3 leftOversScale = leftOvers.transform.localScale;
                    leftOversScale.x = 0.2f;
                    leftOversScale.y = 0.4f;
                    leftOversScale.z = 0.2f;
                    leftOvers.transform.localScale = leftOversScale;
                }
                else if (other.GetComponent <MeshFilter>().mesh.name == "mod_laboratory_beaker Instance")
                {
                    Vector3 leftOversScale = leftOvers.transform.localScale;
                    leftOversScale.x = 70f;
                    leftOversScale.y = 70f;
                    leftOversScale.z = 70f;
                    leftOvers.transform.localScale = leftOversScale;
                }
                else if (other.GetComponent <MeshFilter>().mesh.name == "mod_laboratorium_flask Instance")
                {
                    Vector3 leftOversScale = leftOvers.transform.localScale;
                    leftOversScale.x = 50f;
                    leftOversScale.y = 50f;
                    leftOversScale.z = 50f;
                    leftOvers.transform.localScale = leftOversScale;
                }

                _isBeakerDirty = true;

                AreParticlesInitiated = true;
            }
            else if (other.gameObject.name == "Orange Substance Beaker(Clone)" ||
                     other.gameObject.name == "Yellow Substance Beaker(Clone)" ||
                     other.gameObject.name == "Red Substance Beaker(Clone)" ||
                     other.gameObject.name == "Green Substance Beaker(Clone)" ||
                     other.gameObject.name == "Water Beaker(Clone)")
            {
                Destroy(other.transform.GetChild(0).gameObject);
            }
            // End-game statement
            if (AreParticlesInitiated == false && (BinType == "Warm" &&
                                                   other.gameObject.name == "Green Substance Beaker(Clone)"))
            {
                _currentParticles = Instantiate(ExplosionParticles, gameObject.transform);
                _currentParticles.GetComponent <AudioSource>().volume = ObjectivesSelector.SoundsVolume;

                Invoke("GameOver", 0.7f);
            }
            else if (other.gameObject.name == "Blue Substance Beaker(Clone)" ||
                     other.gameObject.name == "Purple Substance Beaker(Clone)" ||
                     other.gameObject.name == "Orange Substance Beaker(Clone)" ||
                     other.gameObject.name == "Yellow Substance Beaker(Clone)" ||
                     other.gameObject.name == "Red Substance Beaker(Clone)" ||
                     other.gameObject.name == "Water Beaker(Clone)")
            {
                Destroy(other.transform.GetChild(0).gameObject);
            }

            if (_currentParticles != null)
            {
                _currentParticles.GetComponent <AudioSource>().volume = ObjectivesSelector.SoundsVolume;
            }

            // **************************************
            // Cold colors trash bin effects
            if (AreParticlesInitiated == false && (BinType == "Cold" && other.gameObject.name == "Red Substance Beaker(Clone)" || other.gameObject.name == "Orange Substance Beaker(Clone)" || other.gameObject.name == "Yellow Substance Beaker(Clone)"))
            {
                Destroy(other.transform.GetChild(0).gameObject);

                GameObject leftOvers = Instantiate(Leftovers,
                                                   other.transform.position,
                                                   Quaternion.identity,
                                                   other.transform);
                Leftovers.tag = "Smelly Waste";

                Vector3 leftOversScale = leftOvers.transform.localScale;
                if (other.GetComponent <MeshFilter>().mesh.name == "laboratory_testTube_tube Instance")
                {
                    leftOversScale.x = 0.2f;
                    leftOversScale.y = 0.4f;
                    leftOversScale.z = 0.2f;
                }
                else if (other.GetComponent <MeshFilter>().mesh.name == "mod_laboratory_beaker Instance")
                {
                    leftOversScale.x = 70f;
                    leftOversScale.y = 70f;
                    leftOversScale.z = 70f;
                }
                else if (other.GetComponent <MeshFilter>().mesh.name == "mod_laboratorium_flask Instance")
                {
                    leftOversScale.x = 50f;
                    leftOversScale.y = 50f;
                    leftOversScale.z = 50f;
                }

                leftOvers.transform.localScale = leftOversScale;

                _isBeakerDirty = true;

                MeltBin();
                //Instantiate(SmokeParticles, gameObject.transform);
                //_areParticlesInitiated = true;
            }
            else if (
                other.gameObject.name == "Blue Substance Beaker(Clone)" &&
                other.gameObject.name == "Purple Substance Beaker(Clone)" &&
                other.gameObject.name == "Green Substance Beaker(Clone)" &&
                other.gameObject.name == "Water Beaker(Clone)")
            {
                Destroy(other.transform.GetChild(0).gameObject);
            }

            if (other.CompareTag("Beaker"))
            {
                if (other.transform.gameObject.transform.childCount > 0 && other.transform.gameObject.transform.GetChild(0).name != "Smelly Waste(Clone)")
                {
                    ProfileSystemController.TimesAnIncidentWasCaused++;
                    ProfileSystemController.UpdateProfileData();
                }

                if (other.GetComponent <MeshFilter>().mesh.name == "mod_laboratorium_flask_T2 Instance")
                {
                    other.name = "Round Empty Beaker";
                }
                else if (other.GetComponent <MeshFilter>().mesh.name == "mod_laboratorium_flask Instance")
                {
                    other.name = "Empty Beaker";
                }
                else if (other.GetComponent <MeshFilter>().mesh.name == "mod_laboratory_beaker Instance")
                {
                    other.name = "Big Empty Beaker";
                }
                else if (other.GetComponent <MeshFilter>().mesh.name == "laboratory_testTube_tube Instance")
                {
                    other.name = "Small Empty Beaker";
                }
            }
            if (other.CompareTag("Dropper"))
            {
                if (other.transform.childCount > 0)
                {
                    Destroy(other.transform.GetChild(0).gameObject);
                    other.name = "Empty Dropper";
                }
            }

            if (_isBeakerDirty)
            {
                other.gameObject.tag = "Dirty Beaker";
            }
        }
    }
Exemplo n.º 7
0
    void Update()
    {
        // We want the player to select a new mission on if the
        // current one is null (no current mission), so we toggle
        // the buttons for selecting objectives.
        if (CurrentObjective != null)
        {
            foreach (var button in ObjectiveButtons)
            {
                button.GetComponent <Button>().interactable = false;
            }
        }
        else if (CurrentObjective == null && HandinController.IsObjectiveHandedIn)
        {
            foreach (var button in ObjectiveButtons)
            {
                button.GetComponent <Button>().interactable = true;
            }
        }

        // If the player has completed the requirements to finish
        // his current objective and that objective's number is not different from any other
        // only then can we go to the next mission.
        if (PickedUpWaterBottle && PlacedBackWaterBottle &&
            CurrentObjective == "Use Water Bottle" && HandinController.IsObjectiveHandedIn)
        {
            TaskFields[1].GetComponentInChildren <Image>().color = Color.green;
            // We update the current objective index so that
            // we can use the new tasks for the tablet's display.
            //_currentObjectiveNumber++;
            // Once the objective is complete, we set the current objective
            // string to null, so that the player will have the option to select
            // the next objective in the selector screen.
            CurrentObjective = null;
            CurrentObjectiveText.GetComponent <Text>().text = "Select Objective...";
            //GoNextObjective();
        }

        if (CurrentObjective == "Use Water Bottle")
        {
            if (PickedUpWaterBottle)
            {
                TaskFields[0].GetComponentInChildren <Image>().color = Color.green;
            }
            if (PlacedBackWaterBottle)
            {
                TaskFields[1].GetComponentInChildren <Image>().color = Color.green;
            }

            if (IsNotificationBarFlashed == false &&
                PickedUpWaterBottle &&
                PlacedBackWaterBottle &&
                PointerController.IsWearingCoat == true)
            {
                CheckIfPlayerCanHandIn();
            }
        }

        if (UsedTeleporter && CurrentObjective == "Mix Colors" &&
            HandinController.IsObjectiveHandedIn)
        {
            TaskFields[0].GetComponentInChildren <Image>().color = Color.green;
            CurrentObjective = null;
            CurrentObjectiveText.GetComponent <Text>().text = "Select Objective...";
            //_currentObjectiveNumber++;
            //GoNextObjective();
        }

        if (CurrentObjective == "Mix Colors")
        {
            if (PourRedIntoTube)
            {
                TaskFields[0].GetComponentInChildren <Image>().color = Color.green;
            }
            if (PourBlueIntoTube)
            {
                TaskFields[1].GetComponentInChildren <Image>().color = Color.green;
            }
            if (PourYellowIntoTube)
            {
                TaskFields[2].GetComponentInChildren <Image>().color = Color.green;
            }
            if (MixRedAndYellow)
            {
                TaskFields[3].GetComponentInChildren <Image>().color = Color.green;
            }
            if (MixRedAndBlue)
            {
                TaskFields[4].GetComponentInChildren <Image>().color = Color.green;
            }
            if (MixBlueAndYellow)
            {
                TaskFields[5].GetComponentInChildren <Image>().color = Color.green;
            }

            if (IsNotificationBarFlashed == false &&
                PourRedIntoTube &&
                PourBlueIntoTube &&
                PourYellowIntoTube &&
                MixRedAndYellow &&
                MixRedAndBlue &&
                MixBlueAndYellow)
            {
                CheckIfPlayerCanHandIn();
            }
        }

        // Once the player is wearing a coat, his indicator will turn green
        // so that he is aware that he is wearing a coat.
        if (PointerController.IsWearingCoat == true)
        {
            _labCoatRenderer.material = _greenFlashIndicator;
        }
        else
        {
            _labCoatRenderer.material = _redFlashIndicator;
        }

        if (PointerController.IsWearingGlasses == true)
        {
            _labGlassesRenderer.material = _greenFlashIndicator;
        }
        else
        {
            _labGlassesRenderer.material = _redFlashIndicator;
        }

        if (PointerController.IsWearingGloves == true)
        {
            _labGlovesRenderer.material = _greenFlashIndicator;
        }
        else
        {
            _labGlovesRenderer.material = _redFlashIndicator;
        }

        Ray        ray = new Ray(Pointer.transform.position, Pointer.transform.forward);
        RaycastHit hit;

        // If the player happens to hover over UI elements such as
        // buttons, then they will be updated here on different events.
        if (Physics.Raycast(ray, out hit, 100, CatchButtonLayer))
        {
            var  lookedAtButton       = hit.collider.gameObject;
            bool isButtonInteractable = lookedAtButton.GetComponent <Button>().interactable;
            if (isButtonInteractable)
            {
                if (lookedAtButton.GetComponent <Image>() != null)
                {
                    // _image = lookedAtButton.GetComponent<Image>();
                    //_image.color = Color.red;
                }

                if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger) ||
                    Input.GetKeyDown(KeyCode.K))
                {
                    //_image.color = Color.green;

                    // Button functionality/behaviour on click events
                    if (lookedAtButton.name == "Use Water Bottle")
                    {
                        TextObject.GetComponent <Text>().text = string.Empty;
                        Instantiate(LabEquipment, GameObject.Find("Lab Desks").transform);

                        //ProfileSystemController.TriesOnLevelMixColors++;
                        ProfileSystemController.PlayingALevel = true;
                        ProfileSystemController.UpdateProfileData();

                        //if (PointerController.IsWearingCoat == true)
                        //{
                        // Resetting the safety guidelines board's text current value
                        // so we can replace it with the new objectives'.
                        SafetyGuidelinesBoardText.text  = "";
                        SafetyGuidelinesBoardText.text += "* It is mandatory that the player wears a lab coat.\n";
                        SafetyGuidelinesBoardText.text += "* It is mandatory that the player wears proper eye protection.\n";
                        SafetyGuidelinesBoardText.text += "* It is mandatory that the player wears proper hand protection.\n";
                        SafetyGuidelinesBoardText.text += "* It is important that the player mixes the correct chemicals and disposes of any mistakes in their proper containers.\n";
                        SafetyGuidelinesBoardText.text += "* It is important that the player does not pour mixed solutions into their original containers.\n";
                        SafetyGuidelinesBoardText.text += "* It is mandatory that the player washes any used glassware after they are done using them.\n";


                        SelectObjectiveUseWaterBottle();

                        CanOpenDoor = true;

                        // We dont want the player to think he should click any of these
                        // buttons before he actually can be able to.
                        DisableButtonsInteractivity();

                        // If the player is in fact wearing a coat, then flash the indicator as
                        // green once he takes the new objective.
                        //StartCoroutine(FlashIndicator(_labCoatIndicator, _greenFlashIndicator));
                        //}
                        //else
                        //{
                        // Otherwise flash a red indicator so that the player will immediately
                        // know if he needs to have equipment beforehand.
                        //StartCoroutine(FlashIndicator(_labCoatIndicator, _redFlashIndicator));
                        //}
                    }
                    else if (lookedAtButton.name == "Use Teleporter")
                    {
                        _player.GetComponent <SamplePlayerController>().EnableLinearMovement = true;
                        _player.GetComponent <CharacterController>().enabled = true;

                        TextObject.GetComponent <Text>().text = string.Empty;
                        Instantiate(LabEquipment, GameObject.Find("Lab Desks").transform);
                        SelectObjectiveUseTeleporter();

                        CanOpenDoor = true;

                        DisableButtonsInteractivity();
                    }
                    else if (lookedAtButton.name == "Mix Colors")
                    {
                        /*
                         * _player.GetComponent<SamplePlayerController>().EnableLinearMovement = true;
                         * _player.GetComponent<CharacterController>().enabled = true;
                         */

                        Instantiate(LabEquipment, GameObject.Find("Lab Desks").transform);
                        ProfileSystemController.TriesOnLevelMixColors++;
                        ProfileSystemController.PlayingALevel = true;
                        ProfileSystemController.UpdateProfileData();

                        for (int i = 0; i < 4; i++)
                        {
                            TaskFields[i].SetActive(true);
                        }

                        SafetyGuidelinesBoardText.text  = "";
                        SafetyGuidelinesBoardText.text += "* It is mandatory that the player wears a lab coat.\n";
                        SafetyGuidelinesBoardText.text += "* It is mandatory that the player wears proper eye protection.\n";
                        SafetyGuidelinesBoardText.text += "* It is mandatory that the player wears proper hand protection.\n";
                        SafetyGuidelinesBoardText.text += "* It is important that the player mixes the correct chemicals and disposes of any mistakes in their proper containers.\n";
                        SafetyGuidelinesBoardText.text += "* It is important that the player does not pour mixed solutions into their original containers.\n";
                        SafetyGuidelinesBoardText.text += "* It is mandatory that the player washes any used glassware after they are done using them.\n";

                        SelectObjectiveMixColors();

                        CanOpenDoor = true;

                        // We want to be able to go through the different pages of
                        // this objective because it contains more than 4 tasks.
                        _isNextPageAvailable = true;
                    }
                    else if (lookedAtButton.name == "Next Page Button" && CurrentObjective == "Mix Colors" && _isNextPageAvailable)
                    {
                        GoForwardAPage();
                    }
                    else if (lookedAtButton.name == "Prev Page Button" && CurrentObjective == "Mix Colors")
                    {
                        GoBackAPage();
                    }
                    else if (lookedAtButton.name == "Volume Down")
                    {
                        if (lookedAtButton.transform.parent.name == "Master Volume")
                        {
                            _musicAudioSource.volume  -= volumeUpdateValue;
                            _soundsAudioSource.volume -= volumeUpdateValue;
                            _doorAudioSource.volume   -= volumeUpdateValue;
                        }
                        else if (lookedAtButton.transform.parent.name == "Sounds Volume")
                        {
                            _soundsAudioSource.volume -= volumeUpdateValue;
                            _doorAudioSource.volume   -= volumeUpdateValue;
                            _playerAudioSource.volume -= volumeUpdateValue;
                        }
                        else if (lookedAtButton.transform.parent.name == "Music Volume")
                        {
                            _musicAudioSource.volume -= volumeUpdateValue;
                        }

                        //MusicVolume = _musicAudioSource.volume;
                        SoundsVolume = _soundsAudioSource.volume;
                        // This plays the click sound once a button has been pressed
                        // so that the player can see how his sound setting was updated.
                        _playerAudioSource.PlayOneShot(_playerAudioSource.clip);
                    }
                    else if (lookedAtButton.name == "Volume Up")
                    {
                        if (lookedAtButton.transform.parent.name == "Master Volume")
                        {
                            _musicAudioSource.volume  += volumeUpdateValue;
                            _soundsAudioSource.volume += volumeUpdateValue;
                            _doorAudioSource.volume   += volumeUpdateValue;
                        }
                        else if (lookedAtButton.transform.parent.name == "Sounds Volume")
                        {
                            _soundsAudioSource.volume += volumeUpdateValue;
                            _doorAudioSource.volume   += volumeUpdateValue;
                            _playerAudioSource.volume += volumeUpdateValue;
                        }
                        else if (lookedAtButton.transform.parent.name == "Music Volume")
                        {
                            _musicAudioSource.volume += volumeUpdateValue;
                        }
                        _playerAudioSource.PlayOneShot(_playerAudioSource.clip);

                        //MusicVolume = _musicAudioSource.volume;
                        SoundsVolume = _soundsAudioSource.volume;
                    }
                }
            }
            // If the player is holding an item and needs to return it, he must
            // be hovering over the original indicator for that item and press the
            // controller button to return the item and remove it from his hand.
        }
        else
        {
            /*
             * if (_image != null)
             * {
             *  _image.color = Color.white;
             * }
             */
        }

        if (Input.GetKeyDown(KeyCode.F) && CurrentObjective == "Mix Colors" && _isNextPageAvailable)
        {
            GoForwardAPage();
        }

        if (Input.GetKeyDown(KeyCode.G) && CurrentObjective == "Mix Colors")
        {
            GoBackAPage();
        }
    }