void _handleLevelGate(GameObject obj) { GameObject gate = obj.transform.parent.gameObject; LevelGate scr = gate.GetComponent <LevelGate>(); _setupLevel(scr.level); levelGate = null; Destroy(gate); }
void _checkWinLevel() { if (count >= totalPickups) { float runTime = _levelDuration(); winText.text = "<size=48>YOU WIN!</size>\n<size=24>Time: " + runTime.ToString("F2") + "</size>"; PlayerPrefs.SetFloat("LastRunDuration" + level.ToString(), runTime); Vector3 position = _levelGateVector(); Quaternion angle = Quaternion.LookRotation((position - transform.position).normalized); GameObject obj = Instantiate(levelGatePrefab, position, angle) as GameObject; levelGate = obj.GetComponent <LevelGate>(); levelGate.label = "Next Level"; levelGate.level = level + 1; } }