Making raycasts go to the centre of the screen

I heard someone begin to explain this, and want to add it to my game.

var damage : float = 5;
 function Update () {
	var direction = transform.TransformDirection(Vector3.left);
	var hit : RaycastHit;
	var localOffset = transform.position;
	
	if(Input.GetButtonDown("Fire1")){
		if (Physics.Raycast (localOffset, direction, hit, 400)) {
			Debug.DrawLine (localOffset, hit.point, Color.cyan);
			print("we have fired!");
			hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);
		}
	}
}

How could I add it to this script?

Player Prefs will work on mobile and PC platforms. There is some limitation on the web use:

http://unity3d.com/support/documentation/ScriptReference/PlayerPrefs.html

Note this is for a players local score only and is not a global high score table - you’ll need to do a bit more work for that :wink: