Game Development Reference
In-Depth Information
55.
magazineCount--;
56.
reloadProgress = 0;
57.
SendMes-
sage("OnReloadComplete",
58.
SendMes-
sageOptions.DontRequireReceiver);
59.
}
60.
}
61.
}
62.
63.
public void Fire(){
64.
//Make sure the weapon is in hand and not
65.
//currently reloading, enforce time gap between firings,
66.
//and make sure that the weapon is either automatic
67.
//or the trigger has been released after last firing
68.
if(inHand && reloadProgress == 0 &&
69.
(automatic || !triggerPulled) &&
70.
Time.time - lastFiringTime > 1 / fireRate){
71.
//Do we have enough ammo in the current magazine?
72.
if(magazineSize >= ammoPerFiring){
Search WWH ::




Custom Search