using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class GameManager : MonoBehaviour { public GameObject PipesHolder; public GameObject[] Pipes; public GameObject maincam, gamecam; [SerializeField]int correctedPipe = 0; [SerializeField]int totalPipes = 0; // Start is called before the first frame update void Start() { totalPipes = PipesHolder.transform.childCount-2; Pipes = new GameObject[totalPipes]; for(int i = 0 ; i < Pipes.Length ; i++) { Pipes[i] = PipesHolder.transform.GetChild(i).gameObject; } } // Update is called once per frame public void CorrectMove(){ correctedPipe++; if(correctedPipe == totalPipes){ Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; maincam.SetActive(true); gamecam.SetActive(false); } } public void WrongMove(){ correctedPipe--; } }