public void Restart() { running = true; score_recorder.Reset(); disk_factory.Reset(); round = 1; trial = 0; HP = 5; }
//重新开始 public void ReStart() { running = true; score_recorder.Reset(); disk_factory.Reset(); round = 1; trial = 1; //speed = 2f; }
void Update() { if (running) { count++; //用户按下鼠标左键时进行Hit事件处理 if (Input.GetButtonDown("Fire1")) { Hit(Input.mousePosition); } //根据游戏轮次设计飞碟的类型和发射速率 int speed = 300 - round * 50; if (count >= speed) { count = 0; float rand; switch (round) { case 1: SendDisk(1); break; case 2: rand = Random.Range(0, 1f); if (rand < 0.6f) { SendDisk(1); } else { SendDisk(2); } break; case 3: rand = Random.Range(0, 1f); if (rand < 0.4f) { SendDisk(1); } else if (rand < 0.8f) { SendDisk(2); } else { SendDisk(3); } break; case 4: rand = Random.Range(0, 1f); if (rand < 0.2f) { SendDisk(1); } else if (rand < 0.5f) { SendDisk(2); } else { SendDisk(3); } break; default: break; } trial += 1; if (trial == 10) { if (round == 4) { running = false; } else { round += 1; trial = 0; } } } diskFactory.Reset(); } }