private void SendDisk() //发射飞碟 { float position_x = 16; if (dq.Count != 0) { GameObject disk = dq.Dequeue(); dfree.Add(disk); disk.SetActive(true); float ran_y = Random.Range(1f, 4f); disk.GetComponent <DiskData>().direction = new Vector3(1f, ran_y, 0); Vector3 position = new Vector3(-disk.GetComponent <DiskData>().direction.x *position_x, ran_y, 0); disk.transform.position = position; float power = Random.Range(1f * round, 2f * round); float angle = Random.Range(0f, 5f); fam.UFOfly(disk, angle, power, ug.go); } for (int i = 0; i < dfree.Count; i++) { GameObject temp = dfree[i]; if (temp.transform.position.x > 20 && temp.gameObject.activeSelf == true) { df.FreeDisk(dfree[i]); dfree.Remove(dfree[i]); ug.ReduceBlood(); } } }
public void UFOFly(GameObject disk, float angle, float power, bool go, bool flag) //flag == true 物理学, flag == false 运动学 { if (flag) { phy_action_manager.UFOfly(disk, angle, power, go); //如果是物理学,调用PhysicsFlyActionManager类的UFOfly } else { action_manager.UFOfly(disk, angle, power, go); //如果是运动学,调用FlyActionManager类的UFOfly } }
public void UFOFly(GameObject disk, float angle, float power, bool flag) { if (flag) { phy_action_manager.UFOfly(disk, angle, power); } else { action_manager.UFOfly(disk, angle, power); } }