Game Development Reference
In-Depth Information
39.
//return true if a bullet has been shot
40.
public void Shoot(){
41.
if(Time.time - lastShootTime > shootRate){
42.
//Get some random values for inaccuracy
43.
inaccuracyVector.y = Random.Range(
44.
-horizontalInaccuracy,
45.
horizontalInaccuracy);
46.
47.
inaccuracyVector.x = Random.Range(
48.
-verticalInaccuracy,
49.
verticalInaccuracy);
50.
51.
//Rotate the muzzle to apply inaccuracy
52.
muzzle.Rotate(inaccuracyVector.x, 0, 0);
53.
muzzle.Rotate(0, inaccuracyVector.y, 0);
54.
55.
//A variable to store hit data
Search WWH ::




Custom Search