mthackeff
mthackeff
Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
// [HideInInspector]
public string selectedWord;
[HideInInspector]
public string scoreWord = "";
[HideInInspector]
public List<string> WORD_LIST;
Vector2 rowPosition;
int rowLeftIndex = 0;
int rowRightIndex = 0;
bool setup = false;
Button[] left;
Button[] right;
List<Button> buts = new List<Button>();
Button but;
string[] tmpTxt;
[HideInInspector]
public mt_Terminal term;
[HideInInspector]
public int tries;
[HideInInspector]
public bool canHack = false;
[HideInInspector]
public bool isHacking = false;
left = null;
right = null;
tmpTxt = null;
rowLeftIndex = 0;
rowRightIndex = 0;
but = null;
buts.Clear();
buts.TrimExcess();
tries = triesAllowed;
footerText.text = "";
hackingPanel.gameObject.SetActive(false);
accessPanel.gameObject.SetActive(false);
if (term.availability == mt_Terminal.AVAILABILITY.LOCKED)
LockedStart();
else if (term.availability == mt_Terminal.AVAILABILITY.NORMAL)
NormalStart();
else if (term.availability ==
mt_Terminal.AVAILABILITY.UNLOCKED) UnlockedStart();
}
if (!canHack) return;
if (term.availability != mt_Terminal.AVAILABILITY.NORMAL)
return;
if (setup) SetupRows();
if (selectedWord == scoreWord)
{
triesText.color = Color.green;
triesText.text = "Match Found";
return;
}
if (tries > 1)
{
triesText.color = Color.green;
triesText.text = "Attempts Remaining; " + tries.ToString();
}
void UpdateCursorLock()
{
#if UNITY_ANDROID || UNITY_IPHONE
return;
#else
if (Pause || canHack) return;
void NormalStart()
{
void LockedStart()
{
triesText.text = "TERMINAL LOCKED";
triesText.color = Color.red;
footerText.color = Color.red;
footerText.text = "SYSTEM HAS BEEN LOCKED DUE TO MALICOUS
ACTIVITY, PLEASE CONTACT A SYSTEM ADMINISTRATOR TO RESET LOGIN";
}
void UnlockedStart()
{
headerText.text = "welcome to M-CO Industries [TM] ComLink 2.0\
n Password Accepted";
hackingPanel.SetActive(false);
accessPanel.SetActive(true);
GameObject go = Instantiate(rowPrefab[Random.Range(0,
rowPrefab.Count - 1)]);
go.transform.SetParent(GameObject.Find("PanelLeft/Rows").transform,
false);
rowPosition.x = -30;
rowPosition.y = 100 - (15 * rowLeftIndex);
rowLeftIndex++;
}
else if (rowRightIndex < rowsAmount && rowLeftIndex >=
rowsAmount)
{
go.transform.SetParent(GameObject.Find("PanelRight/Rows").transform,
false);
rowPosition.x = -30;
rowPosition.y = 100 - (15 * rowRightIndex);
rowRightIndex++;
}
go.GetComponent<RectTransform>().localPosition = Vector3.zero;
go.GetComponent<RectTransform>().anchoredPosition = new
Vector2(rowPosition.x, rowPosition.y);
GetComponent<AudioSource>().PlayOneShot(hoverSound);
if (setup && rowLeftIndex >= rowsAmount && rowRightIndex >=
rowsAmount)
{
SetupScoreWord();
setup = false;
}
}
[HideInInspector]
public Transform closestTerminal;
public Transform FindClosestTerminal()
{
if (Player == null) return null;
GameObject[] allTerminals =
GameObject.FindGameObjectsWithTag(terminalTag);
float distance = Mathf.Infinity;
foreach (GameObject go in allTerminals)
{
float curDistance = Vector3.Distance(go.transform.position,
Player.transform.position);
if (curDistance < distance)
{
distance = curDistance;
closestTerminal = go.transform;
}
}
return closestTerminal;
}