I am writing some code in JavaScript for a ray cast shooting program. I have all the variables I need except for sound, and I'm not too sure on how to add that variable into my code. I would really appreciate any help people can give to solve this problem, and show me how to add a sound variable to my code.
#pragma strict
var Effect : Transform;
var Damage = 100;
function Update () {
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));
if (Input.GetMouseButtonDown(0))
{
if (Physics.Raycast (ray, hit, 100))
{
hit.transform.SendMessage("ApplyDamage", Damage, SendMessageOptions.DontRequireReceiver);
}
}
}
var foo : Bar;
->Bar foo;
,function foo() : Bar
->public Bar foo()
, and (for parameters inside functions)foo : Bar
->Bar foo
(which you can catch with the first, if the first just removes thevar
) \$\endgroup\$