public void CorrectAnswer() { Debug.Log("Correct Answer.....Checking for items"); //TODO: Check the player's inventory and get the item if (!unlocked) { Player p = null; for (int i = 0; i < dialogueSystem.allActors.Length; i++) { p = dialogueSystem.allActors[i].GetComponent <Player>(); if (p != null) { break; } } if (p == null) { Debug.Log("There is no player added to the actors list. Add the player."); return; } if (dialogueSystem.dialogueSequence[dialogueSystem.GetCurrentSequenceIndex()].itemsExpecting.Count > 0) { //Enable the item selection canvas and wait for check InitiateItemSelection(p); } else { correctAnswers++; } if (correctAnswers == dialogueSystem.numberOfQuestions) { if (!routineUnderProgress) { if (blockingPlatform != null) { StartCoroutine(SimplePlatformInterpolation(targetLocalPosition, targetLocalRotation)); } else { GetComponent <BoxCollider2D>().enabled = false; } //correctAnswers = 0; } } return; //the item does not exist in the inventory } if (!routineUnderProgress) { if (blockingPlatform != null) { StartCoroutine(SimplePlatformInterpolation(targetLocalPosition, targetLocalRotation)); } else { GetComponent <BoxCollider2D>().enabled = false; } } }