/// <summary> /// Toggles on/off character light /// </summary> public void ToggleCharacterLight() { Light light = GetComponentInChildren <Light> (); if (light != null) { light.enabled = !light.enabled; } env.UpdateLights(); if (light.enabled) { env.ShowMessage("<color=green>Player torch <color=yellow>ON</color></color>"); } else { env.ShowMessage("<color=green>Player torch <color=yellow>OFF</color></color>"); } }
void UserConsoleCommandHandler() { if (inputField == null) { return; } string text = inputField.text; bool sanitize = false; for (int k = 0; k < forbiddenCharacters.Length; k++) { if (text.IndexOf(forbiddenCharacters [k]) >= 0) { sanitize = true; break; } } if (sanitize) { string[] temp = text.Split(forbiddenCharacters, StringSplitOptions.RemoveEmptyEntries); text = String.Join("", temp); } if (!string.IsNullOrEmpty(text)) { lastCommand = text; bool captured = false; if (OnConsoleNewCommand != null) { captured = OnConsoleNewCommand(inputField.text); } if (!captured && !ProcessConsoleCommand(text)) { env.ShowMessage(text); } if (inputField != null) { inputField.text = ""; FocusInputField(); // avoids losing focus } } }