public void LoadResources() { disk_queue.Enqueue(disk_factory.GetDisk(round + 1)); if (score_recorder.score >= trial[round][3]) { disk_queue.Enqueue(disk_factory.GetDisk(round + 1)); } if (score_recorder.score >= trial[round][6]) { disk_queue.Enqueue(disk_factory.GetDisk(round + 1)); } }
// Update is called once per frame void Update() { if (userGUI.mode == 0) { return; } GetHit(); gameOver(); if (round > max_round) { return; } timer -= Time.deltaTime; if (timer <= 0 && actionManager.RemainActionCount() == 0) { //从工厂中得到10个飞碟,为其加上动作 for (int i = 0; i < 10; ++i) { disk = factory.GetDisk(round); actionManager.MoveDisk(disk); //Thread.Sleep(100); } round += 1; if (round <= max_round) { userGUI.round = round; } timer = 4.0f; } }
// Update is called once per frame void Update() { if (userGUI.status == 1) { if (time > 4f) { RoundOver(); } else { time += Time.deltaTime; if (this.Playing == false) { DiskFlyOneTime = Random.Range(min, max); //Debug.Log(DiskFlyOneTime); GameObject temp; for (int i = 0; i < DiskFlyOneTime; i++) { //Debug.Log(Factory+"here"); temp = Factory.GetDisk(this.Round); temp.transform.position = position[i]; temp.transform.GetComponent <Rigidbody>().velocity = temp.GetComponent <Disk>().direction *temp.GetComponent <Disk>().speed; Disks.Enqueue(temp); } this.Playing = true; } } } }
private void Update() { if (mode != ActionMode.NOTSET && actionManager != null) { time += Time.deltaTime; if (actionManager.getDiskNumber() == 0 && gameState == GameState.RUNNING) { gameState = GameState.ROUNDFINISH; } if (actionManager.getDiskNumber() == 0 && gameState == GameState.START) { currentRound = (currentRound + 1) % round; DiskFactory df = Singleton <DiskFactory> .Instance; for (int i = 0; i < diskNumber; i++) { diskQueue.Enqueue(df.GetDisk(currentRound, mode)); } actionManager.StartThrow(diskQueue); actionManager.setDiskNumber(10); gameState = GameState.RUNNING; } if (time > 1) { DiskRun(); time = 0; } } }
void Update() { if (start == true) { count++; if (count >= 80) { count = 0; if (DF == null) { Debug.LogWarning("DF is NUll!"); return; } tral++; Disk d = DF.GetDisk(round); Manager.MoveDisk(d); if (tral == 10) { round++; tral = 0; } } } }
void NextRound() { DiskFactory newfactory = Singleton <DiskFactory> .Instance; for (int i = 0; i < 10; i++) { diskQueue.Enqueue(newfactory.GetDisk(round)); } }
void updateMethod() { if (round < 4) { timeGap += Time.deltaTime; if (timeGap >= 2f) { int wait = UnityEngine.Random.Range(3, disk / 3); left -= wait; if (left <= 0) { round++; left = disk; } for (int i = 0; i < wait; i++) { Color color = diskColors[UnityEngine.Random.Range(0, 3)]; float speed = diskSpeed[round]; Vector3 direction = new Vector3( UnityEngine.Random.Range(-1000f, 1000f), UnityEngine.Random.Range(-1000f, 1000f), 0 ); direction.Normalize(); ruler tmpRuler = new ruler(color, direction, Vector3.zero); tmpRuler.vx = UnityEngine.Random.Range(-1f, 1f); tmpRuler.vy = UnityEngine.Random.Range(0f, 5f); tmpRuler.vz = UnityEngine.Random.Range(-1f, 1f); disklist.Add(factory.GetDisk(Vector3.zero, new Vector3(tmpRuler.vx, tmpRuler.vy, tmpRuler.vz), diskSpeed[round], color)); } timeGap = 0; } for (int i = 0; i < disklist.Count; i++) { if (disklist[i].gameObject.transform.position.y < 0) { recycleDisk(disklist[i]); } } for (int i = 0; i < disklist.Count; i += 1) { moveDisk(disklist[i]); } if (Input.GetButtonDown("Fire1")) { Ray ray = cam.ScreenPointToRay(Input.mousePosition); RaycastHit raycastHit; if (Physics.Raycast(ray, out raycastHit)) { recorder.record(raycastHit.transform.gameObject.GetComponent <DiskData>(), round); recycleDisk(raycastHit.transform.gameObject.GetComponent <DiskData>()); // GUI.Label(new Rect(10, 10, 50, 100),recorder.toString()); } } } }
private void NextRound() { DiskFactory df = Singleton <DiskFactory> .Instance; for (int i = 0; i < diskNumber; i++) { diskQueue.Enqueue(df.GetDisk(currentRound, mode)); } actionManager.StartGame(diskQueue); }
public void LoadResources() { throwNum = roundControl.getUFONum(); for (int i = 0; i < throwNum; i++) { disk_queue.Enqueue(diskFactory.GetDisk()); throwDisk(); } roundControl.setRound(); }
public void SendDisk() { //从工厂生成一个飞碟 GameObject disk = diskFactory.GetDisk(round); //设置飞碟的随机位置 disk.transform.position = new Vector3(-disk.GetComponent <DiskData>().direction.x * 7, UnityEngine.Random.Range(0f, 8f), 0); disk.SetActive(true); //设置飞碟的飞行动作 actionManager.Fly(disk, disk.GetComponent <DiskData>().speed, disk.GetComponent <DiskData>().direction); }
private void NextRound() { DiskFactory df = Singleton <DiskFactory> .Instance; for (int i = 0; i < diskNumber; i++) { diskQueue.Enqueue(df.GetDisk(curMode, mode)); } actionManager.beginThrow(diskQueue); }
public void LaunchDisk() { if (count - leaveSeconds == 1) { count = leaveSeconds; GameObject disk = diskFactory.GetDisk(); Debug.Log(disk); disks.Add(disk); actionManager.addRandomAction(disk); } }
void ThrowDisk() { DiskFactory df = Singleton <DiskFactory> .Instance; GameObject disk = df.GetDisk(round); float y = UnityEngine.Random.Range(0f, 4f); Vector3 position = new Vector3(-disk.GetComponent <DiskData>().direction.x * 7, y, 0); disk.transform.position = position; disk.SetActive(true); actionManager.StartThrow(disk); }
public void LaunchDisk()//每秒自动发射飞碟 { if (count - leaveSeconds == 1) { count = leaveSeconds; GameObject disk = diskFactory.GetDisk(round); //从飞碟工厂得到飞碟 Debug.Log(disk); disks.Add(disk); //飞碟进入场景 actionManager.addRandomAction(disk); //让动作管理者设计轨迹 } }
private void NextRound() { currentRound = (currentRound + 1) % round; DiskFactory df = Singleton <DiskFactory> .Instance; for (int i = 0; i < diskNumber; i++) { diskQueue.Enqueue(df.GetDisk(currentRound, mode)); //获得该回合的飞碟队列 } actionManager.StartThrow(diskQueue); }
private void NextRound() { round = (round + 1) % 3; DiskFactory factory = Singleton <DiskFactory> .Instance; for (int i = 0; i < diskCnt; i++) { diskQue.Enqueue(factory.GetDisk(round)); } actionManager.Throw(diskQue); }
void Update() { //出现飞碟的时间延迟 int val = 0; switch (round) { case 1: val = Random.Range(60, 80); break; case 2: val = Random.Range(45, 60); break; case 3: val = Random.Range(30, 45); break; } if (start == true) { count++; if (count >= val) { Disk d = DF.GetDisk(round); fly_manager.UFOfly(d); disk_notshot.Add(d); //加入未打中的对列并检测 count = 0; } for (int i = 0; i < disk_notshot.Count; i++) { Disk temp = disk_notshot[i]; //Debug.Log("333"); //飞碟飞出摄像机视野也没被打中 if (temp.transform.position.y <= -6 && temp.gameObject.activeSelf == true) { //DF.FreeDisk(disk_notshot[i]); disk_notshot.Remove(disk_notshot[i]); //玩家血量-1 //user_gui.ReduceBlood(); //Debug.Log(user_gui.blood); } } if (score_manager.score >= score2 && round == 1) { round++; } if (score_manager.score >= score3 && round == 2) { round++; } } }
private void Update() { //游戏结束 if (scoreRecorder.getScore() <= point[num] && gameState == GameState.ROUND_FINISH) { //再次初始化 currentRound = -1; round = 3; time = 0; num = 0; gameState = GameState.GAME_OVER; scoreRecorder.Reset(); } if (scoreRecorder.getScore() >= 30 && gameState == GameState.ROUND_FINISH) { //再次初始化 currentRound = -1; round = 3; time = 0; num = 0; scoreRecorder.Reset(); gameState = GameState.WIN; } //回合结束 if (actionManager.DiskNumber == 0 && gameState == GameState.RUNNING) { gameState = GameState.ROUND_FINISH; } //回合开始 if (actionManager.DiskNumber == 0 && gameState == GameState.ROUND_START) { currentRound = (currentRound + 1) % round; num++; DiskFactory df = Singleton <DiskFactory> .Instance; for (int i = 0; i < diskNumber; i++) { diskQueue.Enqueue(df.GetDisk(currentRound)); } actionManager.Throw(diskQueue); actionManager.DiskNumber = 10; gameState = GameState.RUNNING; } if (time > 0.5) { ThrowDisk(); time = 0; } else { time += Time.deltaTime; } Debug.Log(num); }
public void Update() { if (!usePhysic) { --flames; if (flames <= 0 && start == true) { flames = Random.Range(60 - round * 3, 60 - round * 1); ++trial; Disk disk = diskFactory.GetDisk(round); actionManager.MoveDisk(disk); if (trial >= 10) { trial = 0; ++round; } } if (Input.GetButtonDown("Fire1")) { Hit(Input.mousePosition); } } }
void Update () { //出现飞碟的时间延迟 int val = 0; switch (round){ case 1: val = Random.Range(150, 180); break; case 2: val = Random.Range(100, 150); break; case 3: val = Random.Range(80, 100); break; } if(start == true){ count ++; if(count >= val){ GameObject d = DF.GetDisk(round); if(action_type == 0){ fly_manager2.UFOfly(d); } else{ fly_manager1.UFOfly(d); } disk_notshot.Add(d.GetComponent<Disk>());//加入未打中的对列并检测 count = 0; } for (int i = 0; i < disk_notshot.Count; i++){ Disk temp = disk_notshot[i]; //飞碟飞出摄像机视野也没被打中 if (temp.transform.position.y <= -6 && temp.gameObject.activeSelf == true){ disk_notshot.Remove(disk_notshot[i]); //玩家血量-1 user_gui.ReduceBlood(); } } if (score_manager.score >= score2 && round == 1){ round++; } if (score_manager.score >= score3 && round == 2){ round++; } } }
void Update() { if (start == true) { count++; if (count >= 120) // 120s over { count = 0; trail++; Disk d = DF.GetDisk(round); Manager.MoveDisk(d); if (trail == 10) { round++; trail = 0; } } } }
void Update() { //val帧产生一个飞碟 int val; switch (round) { case 1: val = Random.Range(60, 80); break; case 2: val = Random.Range(45, 60); break; default: val = 40; break; } if (start) { count++; if (count >= val) //val帧一个飞碟 { count = 0; if (DF == null) { Debug.LogWarning("DF is NUll!"); return; } producedDiskNum++; Disk d = DF.GetDisk(round); Manager.MoveDisk(d); if (producedDiskNum == 20) //15个飞碟进入下一个回合 { round++; producedDiskNum = 0; } } } }
public void LoadResources() { if (round == 1) { throwNum = 1; } if (round == 2) { throwNum = 2; } if (round == 3) { throwNum = 3; } for (int i = 0; i < throwNum; i++) { disk_queue.Enqueue(diskFactory.GetDisk()); throwDisk(); } }
public void LaunchDisk() //每秒自动发射飞碟 { if (count - leaveSeconds == 1) { count = leaveSeconds; for (int i = 0; i < 3; i++) { GameObject disk = diskFactory.GetDisk(round); Debug.Log(disk); disks.Add(disk); if (actionManager.If_Active == 1) { actionManager.addRandomAction(disk); } else { physisManager.addRandomAction(disk); } } } }
// Update is called once per frame void Update() { if (userGUI.mode == 0) { return; } if (userGUI.isKinematic == false) { actionManager = gameObject.GetComponent <PhysicActionManager>() as IActionManager; } else { actionManager = gameObject.GetComponent <CCActionManager>() as IActionManager; } GetHit(); gameOver(); if (round > max_round) { return; } timer -= Time.deltaTime; if (timer <= 0 && actionManager.RemainActionCount() == 0) { //if (timer <= 0) { //从工厂中得到10个飞碟,为其加上动作 for (int i = 0; i < 10; ++i) { disk = factory.GetDisk(round); actionManager.Fly(disk); //Thread.Sleep(100); } round += 1; if (round <= max_round) { userGUI.round = round; } timer = 4.0f; } }
private void SendDisk(int type) { GameObject disk = disk_factory.GetDisk(type); float disk_y = Random.Range(0f, 3f); float disk_x = Random.Range(-1f, 1f) < 0 ? -1 : 1; float speed = 0; float angle = Random.Range(15f, 25f); if (type == 1) { speed = Random.Range(1f, 1.5f); } else if (type == 2) { speed = Random.Range(1.5f, 2f); } disk.transform.position = new Vector3(disk_x * 14f, disk_y, 0); action_manager.DiskFly(disk, angle, speed); }
private void SendDisk(int type) { GameObject disk = disk_factory.GetDisk(type); float disk_y = Random.Range(0f, 3f); float disk_x = Random.Range(-1f, 1f) < 0 ? -1 : 1; float speed = 0; float angle = Random.Range(15f, 25f); if (type == 1) { speed = Random.Range(1f, 1.5f); } else if (type == 2) { speed = Random.Range(1.5f, 2f); } disk.transform.position = new Vector3(disk_x * 14f, disk_y, 0); mes information; information.speed = speed; information.angle = angle; if (physic) { //Debug.Log(speed); action_manager.DiskFly(disk, 1, information); } else { action_manager.DiskFly(disk, 2, information); } }
public void ThrowDisk() { int tmp = Random.Range(0, round); int num = 0; if (tmp < 0.9) { diskQueue.Enqueue(diskFactory.GetDisk(round)); num = 1; } else if (tmp < 2) { diskQueue.Enqueue(diskFactory.GetDisk(round)); diskQueue.Enqueue(diskFactory.GetDisk(round)); num = 2; } else { diskQueue.Enqueue(diskFactory.GetDisk(round)); diskQueue.Enqueue(diskFactory.GetDisk(round)); diskQueue.Enqueue(diskFactory.GetDisk(round)); num = 3; } used = num; for (int i = 0; i < num; i++) { GameObject disk = diskQueue.Dequeue(); Vector3 position = new Vector3(0, 0, 0); float y = UnityEngine.Random.Range(-3f, 2f); position = new Vector3(-disk.GetComponent <DiskInfo>().target.x * 7, y, 0); disk.transform.position = position; disk.SetActive(true); actionManager.flyUFO(disk, disk.GetComponent <DiskInfo>().target, disk.GetComponent <DiskInfo>().speed); } trial--; }
public void LoadResources() { diskFactory.GetDisk(round); diskFactory.Reset(); }
public void playDisk() { GameObject obj = factory.GetDiskObject(factory.GetDisk(sceneController.round)); this.ApplyMoveToAction(obj, sceneController.getSpeedByRound()); }