void DoGatesInOrder(GateTrigger trigger) { if (!complete) { //check which gate was triggered if (gates.Contains(trigger)) { int index = currentList.IndexOf(trigger); //if the start index has not been set if (!inProgress) { Debug.Log("Puzzle started at index " + index); Debug.Log("Gate " + index + " hit"); UpdateList(index); //re-order the list around the new starting index Debug.Log("Current list: " + PrintGateList()); trigger.PlayAudioClip(AssetManager.instance.gateTones[currentIndex]); inProgress = true; StartTimer(); } else { //if the player is touching the gates in order, increment Debug.Log("Gate " + index + " hit"); currentIndex++; if (index == currentIndex) { trigger.PlayAudioClip(AssetManager.instance.gateTones[currentIndex]); Debug.Log("Index " + index + " Current Index " + currentIndex + " Gate Length " + (currentList.Count - 1)); if (index == currentList.Count - 1) { Debug.Log("Complete!"); CompletePuzzle(); } } else { //if this gate was triggered in the wrong order, reset the puzzle trigger.PlayAudioClip(AssetManager.instance.gateTones[6]); ResetPuzzle(); } } } } }
void DoGatesOutOfOrder(GateTrigger trigger) { if (!complete) { //check which gate was triggered if (gates.Contains(trigger)) { int index = currentList.IndexOf(trigger); //if the start index has not been set if (!inProgress) { Debug.Log("Puzzle started at index " + index); Debug.Log("Gate " + index + " hit"); trigger.PlayAudioClip(AssetManager.instance.gateTones[currentIndex]); inProgress = true; gatesHit++; Debug.Log(gates.Count - gatesHit + " gates left!"); StartTimer(); } else { //if the player touched another gate, update accordingly Debug.Log("Gate " + index + " hit"); gatesHit++; Debug.Log(gates.Count - gatesHit + " gates left!"); trigger.PlayAudioClip(AssetManager.instance.gateTones[currentIndex]); if (gatesHit == currentList.Count) { CompletePuzzle(); } } } } }