- Home /
This question was
closed Oct 15, 2013 at 07:26 AM by
Benproductions1 for the following reason:
Question is off-topic or not relevant
Question by
iMusaab · Oct 15, 2013 at 12:19 AM ·
javascriptguifps
How To Make Ammo & Realod for Gun & Spark for Gun ?
Hi guys
how to make ammo in my script and make GUI of ammo like this : 30/270 & make realod for gun
this is my script :
#pragma strict
var Effect : Transform;
var TheDammage = 100;
var shotsPerSecond = 8.0;
private var timestamp = 0.0;
var ShotSound : AudioClip;
function Update () {
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));
if (timestamp <= Time.time && Input.GetMouseButton(0))
{
if (Physics.Raycast (ray, hit, 100))
{
var particleClone = Instantiate(Effect, hit.point, Quaternion.LookRotation(hit.normal));
Destroy(particleClone.gameObject, 2);
hit.transform.SendMessage("ApplyDammage", TheDammage, SendMessageOptions.DontRequireReceiver);
timestamp = Time.time + 1.0 / shotsPerSecond;
}
audio.PlayOneShot(ShotSound);
}
}
Comment
Please adhere to the FAQ when asking questions on this site