
public void AttemptBinaryMatch(TMP_Text Selected)
{
if (_selectionCooldown || BinaryMatchingComplete.activeSelf) {return;}
Selected.transform.GetChild(0).gameObject.SetActive(false);
if(Selected.text == "X")
{
AudioManager.instance.PlaySound(CorruptedSFX, transform, 1f);
ShowHiddenEmail(HiddenEmails[0]);
Debug.Log("Corrupted Bit");
_selectionCooldown = true;
StartCoroutine(BinaryMatchSelectionCooldown(Selected));
return;
}
if (_binaryAlreadySelected == null)
{
Debug.Log("Select Next Card");
_binaryAlreadySelected = Selected;
AudioManager.instance.PlaySound(SelectSFX, transform, 1f);
return;
}
if(_binaryAlreadySelected.text == Selected.text)
{
Debug.Log("Correct Match");
AudioManager.instance.PlaySound(SelectSFX, transform, 1f);
_matchedCards.Add(Selected);
_matchedCards.Add(_binaryAlreadySelected);
_binaryAlreadySelected = null;
if (CheckBinaryMatchCompletion())
{
if (!CheckPreviousTask(BinaryMatchingComplete))
{
Selected = null;
ResetBinaryMatching(Selected);
ShowPromt("Package Extraction Failed, please refer to manual for more information and debugging issues. Error: 752");
return;
}
ShowPromt("Package Extraction Succesful!");
BinaryMatchingComplete.SetActive(true);
}
}
else
{
Debug.Log("Inorrect Match");
AudioManager.instance.PlaySound(ResetSFX, transform, 1f);
_selectionCooldown = true;
StartCoroutine(BinaryMatchSelectionCooldown(Selected));
return;
}
}
private void ResetBinaryMatching(TMP_Text Selected)
{
for (int i = 0; i < BinaryMatchCardsObject.childCount; i++)
{
if(Selected == null || Selected.text == "X")
{
BinaryMatchCardsObject.GetChild(i).GetChild(0).gameObject.SetActive(true);
_matchedCards.Clear();
}
if (_matchedCards.Contains(BinaryMatchCardsObject.GetChild(i).GetComponent()))
{ continue; }
BinaryMatchCardsObject.GetChild(i).GetChild(0).gameObject.SetActive(true);
}
_binaryAlreadySelected = null;
}
private bool CheckBinaryMatchCompletion()
{
for(int i = 0; i < BinaryMatchCardsObject.childCount; i++)
{
var CurrentComponentIteration = BinaryMatchCardsObject.GetChild(i).GetChild(0).gameObject;
if (BinaryMatchCardsObject.GetChild(i).GetComponent().text == "X")
{ continue; }
if (CurrentComponentIteration.activeSelf)
{
return false;
}
}
return true;
}
IEnumerator BinaryMatchSelectionCooldown(TMP_Text Selected)
{
yield return new WaitForSeconds(0.75f);
ResetBinaryMatching(Selected);
_selectionCooldown = false;
}
public void StartMaze()
{
_onMaze = true;
StatusValueText.color = Color.green;
StatusValueText.text = "ACTIVE";
}
public void ToggleGate(GameObject Gate)
{
if (!_onMaze) { return; }
AudioManager.instance.PlaySound(UnlockGateSFX, transform, 1f);
Gate.SetActive(false);
}
public void RestartMaze()
{
if (!_onMaze) { return; }
for (int i = 0; i < GateParent.childCount; i++)
{
GateParent.GetChild(i).gameObject.SetActive(true);
}
_onMaze = false;
ShowPromt("Error! Directory Failed");
StatusValueText.color = Color.red;
StatusValueText.text = "INACTIVE";
}
public void CompleteMaze()
{
if (!_onMaze) { return; }
_onMaze = false;
if (!CheckPreviousTask(CoachDirectorComplete))
{
ShowPromt("Error while manipulating Directories, please refer to manual for more information and debugging issues. Error: 752");
RestartMaze();
return;
}
ShowPromt("Package Add on implementation Succesful!");
CoachDirectorComplete.SetActive(true);
StatusValueText.color = Color.green;
StatusValueText.text = "COMPLETE";
}
public void TextOnTextEffect(TMP_Text TextComponent)
{
TextComponent.text = "";
switch (TextComponent.gameObject.name)
{
case ("PLAY"):
if (_playRoutine != null) { StopCoroutine(_playRoutine); }
_playRoutine = StartCoroutine(TextEffect(TextComponent));
break;
case ("SETTINGS"):
if (_settingsRoutine != null) { StopCoroutine(_settingsRoutine); }
_settingsRoutine = StartCoroutine(TextEffect(TextComponent));
break;
case ("EXIT"):
if (_exitRoutine != null) { StopCoroutine(_exitRoutine); }
_exitRoutine = StartCoroutine(TextEffect(TextComponent));
break;
}
}
IEnumerator TextEffect(TMP_Text TextComponent)
{
foreach(char character in TextComponent.gameObject.name)
{
TextComponent.text += character;
yield return new WaitForSeconds(0.1f);
}
}
public void TextDisapearEffect(TMP_Text TextComponent)
{
switch (TextComponent.gameObject.name)
{
case ("PLAY"):
if (_playRoutine != null) { StopCoroutine(_playRoutine); }
_playRoutine = StartCoroutine(TextDisapearEffectRoutine(TextComponent));
break;
case ("SETTINGS"):
if (_settingsRoutine != null) { StopCoroutine(_settingsRoutine); }
_settingsRoutine = StartCoroutine(TextDisapearEffectRoutine(TextComponent));
break;
case ("EXIT"):
if (_exitRoutine != null) { StopCoroutine(_exitRoutine); }
_exitRoutine = StartCoroutine(TextDisapearEffectRoutine(TextComponent));
break;
}
}
public void PlayGame()
{
Cursour.SetActive(true);
InTitleScreen = false;
Settings.SetParent(MoveSettingsTransform);
Focus();
ObjectiveParent.gameObject.SetActive(true);
ObjectiveParent.GetComponentInChildren().text = "Investigate the knocking at the front door";
DOTween.To(() => Music.volume, x => Music.volume = x, 0.01f, 10f);
}
public void ExitGame()
{
Application.Quit();
}
IEnumerator TextDisapearEffectRoutine(TMP_Text TextComponent)
{
int index = TextComponent.text.Length;
foreach (char character in TextComponent.text)
{
string currentString = TextComponent.text;
currentString = currentString.Remove(index-1);
TextComponent.text = currentString;
index--;
yield return new WaitForSeconds(0.1f);
}
}
}




