private void Update() { if (gameManager.GetCurrentState() == STATEGAME.PLAYING) { if (CheckOverLap.DoOverlap(bird.GetCorners(), Utils.GetWorldCorners(rt)) == true) { gameManager.DoGameOver(); } } }
void Update() { if (gameManager.GetCurrentState() == STATEGAME.PLAYING) { if (Input.GetMouseButtonDown(0)) { soundManager.SoundFlap(); transform.Translate(Vector3.up * flySpeed * 0.5f, Space.World); } else { transform.Translate(Vector3.down * fallSpeed * Time.deltaTime, Space.World); } } }
// Update is called once per frame void Update() { if (gameManager.GetCurrentState() == STATEGAME.PLAYING) { if (time > maxTime) { GameObject newBox = Instantiate(Resources.Load(@"Prefabs\Box") as GameObject, bind); newBox.transform.position = bind.position + new Vector3(0, UnityEngine.Random.Range(-height, height), 0); for (int i = 0; i < newBox.transform.childCount - 1; i++) { newBox.transform.GetChild(i).GetComponent <Box>().bird = bird; newBox.transform.GetChild(i).GetComponent <Box>().gameManager = gameManager; } newBox.transform.GetChild(newBox.transform.childCount - 1).GetComponent <BoxPoint>().bird = bird; newBox.transform.GetChild(newBox.transform.childCount - 1).GetComponent <BoxPoint>().scoreManager = scoreManager; Destroy(newBox, 15); time = 0; } time += Time.deltaTime; } }