Hi.
I have a simple Java Script for Unity which basicly checks a distance and applies damage if it smaller than the Max Distance. Here it is:
#pragma strict
var TheDamage : int = 25;
var Distance : float;
var MaxDistance : float = 1.5;
var TheMace : Transform;
function update ()
{
if (Input.GetButtonDown(“Fire1”))
{
var hit : RaycastHit;
if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit))
{
Distance = hit.distance;
if (Distance < MaxDistance)
{
hit.transform.SendMessage(“ApplyDamage”, TheDamage, SendMessageOptions.DontRequireReceiver);
}
}
}
}
Whenever I click it the Variables don’ change. I am a bit of a newbie with this stuff.
Thanks Ahead.