public void StartQTE() { Debug.Log("StartQTE called"); player.GetComponent <PlayerMovement>().moveSwitch = false; qteTriggered = true; GameObject qtePrefab = Resources.Load("Prefabs/QTEButton") as GameObject; GameObject qte = Instantiate(qtePrefab, canvas.transform.position, Quaternion.identity, canvas.transform); QTEButton qtebutton = qte.GetComponent <QTEButton>(); qtebutton.correctEvent += () => { QteCorrect(1); }; qtebutton.falseEvent += () => { QteFail(1); }; qtebutton.StartQte(); Time.timeScale = 0; }
private void QteCorrect(int i) { Debug.Log("QTE " + i + " Succeeded!"); if (i == 3) { GameManager.save.flags["S1F2"] = true; StartCoroutine(ToScene2()); return; } Destroy(GameObject.Find("Police" + i)); GameObject qtePrefab = Resources.Load("Prefabs/QTEButton") as GameObject; GameObject qte = Instantiate(qtePrefab, canvas.transform.position, Quaternion.identity, canvas.transform); QTEButton qtebutton = qte.GetComponent <QTEButton>(); qtebutton.correctEvent += () => { QteCorrect(i + 1); }; qtebutton.falseEvent += () => { QteFail(i + 1); }; qtebutton.StartQte(); }