/// <summary> /// The start function /// </summary> void Start() { //Initialise NFC AndroidNFCReader.enableBackgroundScan(); AndroidNFCReader.ScanNFC("GameController", "OnMove"); //Set the mapmid active so the map can be filled MapMid.SetActive(true); // Create the locallibrary local = new LocalLibrary(); //Set the mapmid inactive MapMid.SetActive(false); //Set the energy sprite so it shows correctly GameObject newImageObject = GameObject.Find("Energy" + PlayerState.energy); Image newImage = newImageObject.GetComponent <Image>(); placeholderImage.sprite = newImage.sprite; //Set the correct Jeep Image Image jeep = GameObject.Find("JeepImage").GetComponent <Image>(); jeep.sprite = GameObject.Find("Jeep" + PlayerState.vehicle).GetComponent <Image>().sprite; //Set the correct Hat Image Image hat = GameObject.Find("HatImage").GetComponent <Image>(); hat.sprite = GameObject.Find("Hat" + PlayerState.hat).GetComponent <Image>().sprite; }
// void Awake () { // if (instance == null) instance = this; // else if (instance != null) Destroy(gameObject); // DontDestroyOnLoad(gameObject); // } // Use this for initialization void Start() { AndroidNFCReader.enableBackgroundScan(); AndroidNFCReader.ScanNFC(gameObject.name, "OnFinishScan"); nextScene = "mainScreen"; }
void OnGUI() { if (!background) { // Scan NFC button if (GUI.Button(new Rect(0, Screen.height - 50, Screen.width, 50), "Scan NFC")) { AndroidNFCReader.ScanNFC(gameObject.name, "OnFinishScan"); } if (GUI.Button(new Rect(0, Screen.height - 100, Screen.width, 50), "Enable Backgraound Mode")) { AndroidNFCReader.enableBackgroundScan(); background = true; } } else { if (GUI.Button(new Rect(0, Screen.height - 50, Screen.width, 50), "Disable Backgraound Mode")) { AndroidNFCReader.disableBackgroundScan(); background = false; } } GUI.Label(new Rect(0, 0, Screen.width, 50), "Result: " + qrString); }
void OnGUI() { // Scan NFC button if (GUI.Button(new Rect(20, 40, 300, 300), "ScanNFC")) { AndroidNFCReader.ScanNFC(gameObject.name, "OnFinishScan"); } GUI.Label(new Rect(20, 360, 300, 300), "Result: " + qrString); }
/// <summary> /// The start function, run when this script is started. /// </summary> void Start() { //Define 1 random for the entire script Random.InitState((int)System.DateTime.Now.Ticks); //Initalise the variables players.list = new List <Player>(); incidents.list = new List <Incident>(); layout.list = new List <string>(); treasure = new Treasure(); //Iniatialise the nfcreader AndroidNFCReader.enableBackgroundScan(); AndroidNFCReader.ScanNFC("GameController", "OnScan"); }
void OnGUI() { if (!background) { // Scan NFC button if (GUI.Button(new Rect(0, Screen.height - 50, Screen.width, 50), "Scan NFC")) { AndroidNFCReader.ScanNFC(gameObject.name, "OnFinishScan"); } if (GUI.Button(new Rect(0, Screen.height - 100, Screen.width, 50), "Enable Backgraound Mode")) { AndroidNFCReader.enableBackgroundScan(); background = true; } } else { if (GUI.Button(new Rect(0, Screen.height - 50, Screen.width, 50), "Disable Backgraound Mode")) { AndroidNFCReader.disableBackgroundScan(); background = false; } } if (qrString != "NO_ALLOWED_OS") { Debug.Log(qrString); GUI.Label(new Rect(0, 0, Screen.width, 50), "Result: " + qrString + "new Version"); if (qrString.Length < 3) { string url = "http://192.168.0.151:8000/"; t.RoomNumber = Int32.Parse(qrString); WWWForm form = new WWWForm(); form.AddField("", t.RoomNumber); form.AddField("", t.TeamId); byte[] rawData = form.data; var headers = new Dictionary <string, string>(); headers.Add("Stage", "RoomEntery"); WWW www = new WWW(url, rawData, headers); StartCoroutine(WaitForRequest(www)); } } }
public void ScanNFC() { debugOutput.text += "\nScanNFC"; AndroidNFCReader.ScanNFC(gameObject.name, "OnFinishScan"); }
void Start() { AndroidNFCReader.enableBackgroundScan(); AndroidNFCReader.ScanNFC(gameObject.name, "OnFinishScan"); }