void doors() { if (newLine.Contains("ls")) { characters.Add("\n\nDoors available:" + listOfDoors.getNames()); // gets all the names of doors in DoorList } if (newLine.Contains("clear")) { endLine(); output = ""; return; } if (newLine.Contains("help")) { help(); } else { try { int index = int.Parse(newLine.Substring(newLine.Length - 1)); // gets the Door number door = listOfDoors.getDoor(index - 1); // gets the Door from DoorList } catch (FormatException) { characters.Add("\n\nERROR: Please enter name of door\n"); endLine(); return; } if (newLine.Contains("open Door")) { if (!door.doorMoved) { //checks if the door is open StartCoroutine(door.Move()); // sends a signal to Move() in Door script //doorOpen = true; //Debug.Log("Open"); characters.Add("\n\n\t*** DOOR OPENED *** \n"); } } if (newLine.Contains("close Door")) { if (door.doorMoved) { StartCoroutine(door.Move()); // close door //doorOpen = false; //Debug.Log("Close"); characters.Add("\n\n\t*** DOOR CLOSED *** \n"); } } } endLine(); }
void doors() { if (newLine.Contains("ls")) { characters.Add(listOfDoors.getNames()); // gets all the names of doors in DoorList } else { int index = int.Parse(newLine.Substring(newLine.Length - 1)); // gets the Door number door = listOfDoors.getDoor(index - 1); // gets the Door from DoorList if (newLine.Contains("open Door")) { if (!door.doorMoved) //checks if the door is open { StartCoroutine(door.Move()); // sends a signal to Move() in Door script //doorOpen = true; //Debug.Log("Open"); characters.Add("\n\n\t*** DOOR OPENED *** \n"); } } if (newLine.Contains("close Door")) { if (door.doorMoved) { StartCoroutine(door.Move()); // close door //doorOpen = false; //Debug.Log("Close"); characters.Add("\n\n\t*** DOOR CLOSED *** \n"); } } } endLine(); }