I’m not really good with C# so I’m having a hard time trying to figure out how to get this script to wait for about 3 or 4 seconds before allowing access to the next scene to be loaded.
I have also been trying to figure out how to get a sound to play before launching the next scene too.
What might make this one hard to figure out is that each of the log in buttons (and there are many) all use this same script. Here is the code I’m trying to work with.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class readkey : MonoBehaviour
{
private Text inputText;
private Text outputText;
private Text acceptedText;
string secret = "KITT2000";
void Start ()
{
inputText = GameObject.Find ("InputText").GetComponent<Text> ();
outputText = GameObject.Find ("OutputText").GetComponent<Text> ();
inputText.text = "";
}
public void readButton (string c)
{
inputText.text += c;
outputText.text = new string ('*', inputText.text.Length);
if (inputText.text.Length == secret.Length) {
if (inputText.text == secret) {
acceptedText = GameObject.Find ("AcceptedText").GetComponent<Text> ();
Application.LoadLevel ("SystemStatusScreen");
} else {
acceptedText.text = "ACCESS
GRANTED";
outputText.text = “WRONG PASS
TRY AGAIN”;
inputText.text = “”;
}
}
}
}