private void HandleClick() { if (m_CurrentInteractible != null) { //********************************************************************************* STARTS HERE (copyrigthed as mentioned above) ***************************************************************************** if (counter < 6) { if (m_CurrentInteractible.CompareTag("PhaseA")) // If the selected object belongs in trial A { if (m_CurrentInteractible.selected == false) // If the item was not selected before { if (phase == "A") //If the selected object belongs to trial A { correctChoiceA++; //Correct choices incremented by 1 totalCorrect++; //Increament total correct choices by 1 m_CurrentInteractible.gameObject.SetActive(false); //This is for Debugging purposes. We set the visibility of the object to false counter++; } else { wrongChoiceA++; //Wrong choices increamented by 1 totalWrong++; //Increament total wrong choices by 1; } m_CurrentInteractible.selected = true; //we select the item turning the flag true //counter++; //We increse the counter of total selected items } else //The item was selected before and is now deselected { if (CurrentInteractible.CompareTag("PhaseA")) //if the item belonged to trial A { correctChoiceA--; //The correct choices are decreased by 1 totalCorrect--; //Decrease total correct choices by 1 } else { //If the item belonged in trial B then the wrong choices are decreased wrongChoiceA--; // Wrong choises decreased by 1 totalWrong--; //Decrease total wrong choices by 1 } m_CurrentInteractible.selected = false; //we deselect the item turning the select flag to false counter--; //We decrease the counter of total selected items } } else if (m_CurrentInteractible.CompareTag("PhaseB")) // If the selected object belongs to trial B { if (m_CurrentInteractible.selected == false) // If the item was not selected before { if (phase == "B") //If the selected object belongs to trial B { correctChoiceB++; //Correct choices incremented by 1 totalCorrect++; //Increament total correct by 1 m_CurrentInteractible.gameObject.SetActive(false); counter++; } else { wrongChoiceB++; //Wrong choices increamented by 1 totalWrong++; //Increament total wrong choices by 1 } CurrentInteractible.selected = true; //counter++; } else //The item was selected before and is now deselected { m_CurrentInteractible.selected = false; //we deselect the item turning the select flag to false if (CurrentInteractible.CompareTag("PhaseB")) //if the item belonged to trial B { correctChoiceB--; //The correct choices are decreased by 1 totalCorrect--; //Decrease total correct choices by 1 } else { //If the item belonged in phase A then the wrong choices are decreased wrongChoiceB--; // Wrong choises decreased by 1 totalWrong--; //Decrease total wrong choices by 1 } CurrentInteractible.selected = false; // Object was deselected counter--; //Decrease the counter by 1 } } } //If Button ends here else { if (counter >= 5) // If the user has selected all 6 objects and they are ready to go to the next trial or end the game { if (phase == "A") { //Load Trial B phase = "B"; // Load trial B counter = 0; //Reset counter } else { //End game } } } //*********************************************************************************** ENDS HERE ************************************************************************************** m_CurrentInteractible.Click(); } }