Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private IEnumerator COMMAND(string command, string param, TextMeshProUGUI output)
- {
- //override
- if(command == "OVERRIDE")
- {
- int percentage = 0;
- if(GameObject.Find(param) != null && GameObject.Find(param).GetComponent<SecDoor>() != null && GameObject.Find(param).GetComponent<SecDoor>().scanning == true)
- {
- while(percentage < 100)
- {
- output.text = "Overriding " + param + "... [" + percentage + "%]";
- yield return new WaitForSeconds(0.2f);
- percentage++;
- }
- output.text = "Override success!";
- GameObject.Find(param).GetComponent<SecDoor>().open = true;
- }
- else
- {
- output.text = "ERROR: " + param + " does not meet the requirements";
- }
- }
- else if(command == "QUERY")
- {
- try
- {
- if(GameObject.FindGameObjectsWithTag(param) != null)
- {
- output.text = "FOUND:\n";
- GameObject[] searchedObjects = GameObject.FindGameObjectsWithTag(param);
- if(searchedObjects[0] == null)
- {
- output.text = "Cannot find any objects of type: " + param;
- }
- foreach (GameObject objs in searchedObjects)
- {
- if(objs != searchedObjects[searchedObjects.Length - 1])
- {
- output.text += objs.GetComponent<SecDoor>().defName;
- //find mac adress if secDoor
- if(objs.GetComponent<SecDoor>() != null)
- {
- if(objs.GetComponent<SecDoor>().scanning == false)
- {
- output.text += " address access denied";
- }
- else
- {
- output.text += " address is " + objs.GetComponent<SecDoor>().macAdress;
- }
- }
- output.text += "\n";
- }
- else
- {
- output.text += objs.GetComponent<SecDoor>().defName;
- //find mac adress if secDoor
- if(objs.GetComponent<SecDoor>() != null)
- {
- if(objs.GetComponent<SecDoor>().scanning == false)
- {
- output.text += " address access denied";
- }
- else
- {
- output.text += " address is " + objs.GetComponent<SecDoor>().macAdress;
- }
- }
- }
- console.transform.position -= new Vector3(0, 7f, 0);
- }
- }
- console.transform.position -= new Vector3(0, 7f, 0);
- }
- catch
- {
- output.text = "Cannot find any objects of type: " + param;
- console.transform.position -= new Vector3(0, 7f, 0);
- }
- }
- yield return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement