for some reason my melee system won't work it's using raycasts and I did everything right where i make a empty gameobject on the main camera on the player but still nothing.
please help me asap! Thx
ALSO WHOEVER GETS IT RIGHT WILL GET A COPY OF THE GAME WHEN FINISHED
#pragma strict
var TheDammage : int = 50;
var Distance : float;
var MaxDistance : float = 1.5;
var TheSystem : Transform;
function Update ()
{
if (Input.GetButtonDown("Fire1"))
{
//GetComponent.().Play("Attack");
}
}
function AttackDammage ()
{
//Attack function
var hit : RaycastHit;
if (Physics.Raycast (TheSystem.transform.position, TheSystem.transform.TransformDirection(Vector3.forward), hit))
{
Distance = hit.distance;
if (Distance < MaxDistance)
{
hit.transform.SendMessage("ApplyDammage", TheDammage, SendMessageOptions.DontRequireReceiver);
}
}
}
↧