public void FreeDisk(DiskData disk) { DiskData tempDisk = null; foreach (DiskData d in inUsed) { if (d.innerDiskCount == disk.innerDiskCount) { tempDisk = d; } } if (tempDisk == null) { Debug.Log("系统异常"); } else { tempDisk.reStart(); inFree.Add(tempDisk); inUsed.Remove(tempDisk); } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Debug.Log("Fire Pressed"); Vector3 mPosition = Input.mousePosition; Camera ca = camera.GetComponent <Camera>(); Ray ray = ca.ScreenPointToRay(mPosition); RaycastHit rayHit; if (Physics.Raycast(ray, out rayHit)) { DiskData disk = rayHit.collider.gameObject.GetComponent <DiskData>(); //点中了要free disk.reStart(); this.FreeDisk(disk); Singleton <ScoreRecorder> .Instance.Record(disk); } } }