When testing with the script below I get the following error
BCE0051: Operator ‘<’ cannot be used with a left hand side of type ‘function(System.Type): UnityEngine.Component’ and a right hand side of type ‘System.Type’.
#pragma strict
var Damage : int = 50;
var Distance : float;
var MaxDistance : float = 1.5;
var Hammer : Transform;
function Update ()
{
if (Input.GetButtonDown("Fire1"))
{
GetComponent<Animation>("attack");
var hit : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit))
{
Distance = hit.distance;
if (Distance < MaxDistance);
{
hit.transform.SendMessage("ApplyDamage", Damage, SendMessageOptions.DontRequireReceiver);
}
}
}
}