public void collectData() { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; Physics.Raycast(ray, out hit, 100); if (data == StagePurpose[stage]) { data = 0; limitTime = 60; stage++; showProjectName(); } else if (hit.transform.tag == "Coworker") { data += 1; hit.rigidbody.velocity = new Vector3(UnityEngine.Random.Range(-4, 4), 3, UnityEngine.Random.Range(-4, 4)); EmployeeControl victim = hit.transform.GetComponent <EmployeeControl>(); victim.playWhipSound(); Debug.Log("click coworker"); } else if (hit.transform.tag == "Player") { cameraMove camera = GameObject.Find("Main Camera").GetComponent <cameraMove>(); camera.CallfocusPlayer(); PlayerControl player = GameObject.Find("Player").GetComponent <PlayerControl>(); player.showuiInfo(); } else { Debug.Log("click nothing"); } } }