Game Development Reference
In-Depth Information
Objective complete - mini debriefing
In this section, we created the
RocketUI
script to show the number of bullets left on the
screen. The script will automatically update the number of bullets we have left when we
click on
fire
or
reload
.
Next, we created the
RocketLauncher
object and script to fire the rocket, which will show
the
Smoke
particle when we click on
fire
by getting the
playbackTime
value from the
current animation using
AnimationStateInfo
. We get the time left for the current an-
imation to finish by using
currentState.normalizedTime % 1
to calculate the
remaining time and pass it to
BroadcastMessage ("Fire", playbackTime)
to
trigger the
Fire
event.