void shoot() { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (hit.collider != null) { TargetView target = hit.collider.GetComponent <TargetView> (); shootAudio(); if (target.getType() == lastKilledTargetType) { Destroy(target.gameObject); } else { time = 2f; target.playAnimation(); } currentTarget = target.gameObject; playerScores += target.getPointValue(); lastKilledTargetType = target.getType(); Debug.Log("Score: " + playerScores); } } }