/// <summary> /// 重新游戏 /// </summary> public void Replay() { //难度将为初级 //Time.timeScale = 1; //m_audioManager.ScalePlaySpeed(1f); GloableValue.MoveSpeed = 2f; GloableValue.spanTime = 3f; m_audioManager.ScalePlaySpeed(1f); //分数清零 m_scoreRecorder.ReplayInit(); //刷新UI面板 m_topView.ReplayInit(); //小鸟初始化位置 m_birdController.Init(); //重新播放 m_audioManager.PlayBGMusic(); //管子重玩初始化 m_pipesFactory.ReplayInit(); //画布重玩初始化 bgSkyBehaviours.ReplayInit(); IsOver = false; initTime = 0f; m_pipesFactory.CreatePipeGroup(); //游戏开始先创建一个 }
private void CreateBirdBodies() { if (birdsList != null) { for (int i = 0; i < birdsList.Count; i++) //Destroy potential remaining birds { GameObject.Destroy(birdsList[i].gameObject); } } birdsList = new List <BirdController>(); for (int i = 0; i < populationSize; i++) { //1. Instantiate bird prefab GameObject temp = ((GameObject)Instantiate(BirdPrefab, new Vector3(-3f, 2f, 0), BirdPrefab.transform.rotation)); temp.layer = i + 8; BirdController bird = temp.GetComponent <BirdController>(); bird.Init(nets[i]); birdsList.Add(bird); } birdsAlive = populationSize; }