/**Method Name: Start
     * Parameters: N/A
     * Returns: N/A
     *
     * A built-in unity function inherted from MonoBehaviour.
     * This is activated upon start-up to set the scene.
     * This randomizes the sequence list and spawns the objects
     * */
    private void Start()
    {
        //randomization function
        for (int i = 0; i < sequence.Length; i++)
        {
            var rand = Random.Range(0, i);
            var tmp  = sequence[i];
            sequence[i]    = sequence[rand];
            sequence[rand] = tmp;

            Debug.Log(sequence[i]);
        }
        //spawn
        for (int x = 0; x < sequence.Length; x++)
        {
            GameObject block = Instantiate(MemoryBlock) as GameObject;
            block.SetActive(true);
            //each block is named as an integer
            block.name = x.ToString();
            //Anchors the objects to the screen to avoid displacement
            block.transform.SetParent(this.transform);
            //Sets the position of the object relative to the anchor(Top-left)
            block.GetComponent <RectTransform>().anchoredPosition = new Vector2(((x % 3) + 1) * (Screen.width / 4), -(((x / 3) + 1) * (Screen.height / 4)));
        }
        //activates a panel and waits for an OK from the player before showing the sequence
        OKPanel.SetActive(true);
        OKPanel.transform.SetAsLastSibling();
    }
 /**Method Name: BlockClick()
  * Parameters: N/A
  * Returns: N/A
  *
  * This is the main logic of the game. It counts the number of times the user
  * has chosen correctly and resets it when wrong.
  * */
 public void BlockClick()
 {
     //check if showSequence is being executed
     if (!coroutine)
     {
         //if the correct block is selected. Increase click num (game ends when clicknum = sequence length)
         if (ES.currentSelectedGameObject.name == sequence[clickNum].ToString())
         {
             clickNum++;
         }
         //if wrong reset, decrease tries remaining, and show the sequence again
         else
         {
             tries--;
             clickNum = 0;
             OKPanel.SetActive(true);
         }
     }
 }