Game Development Reference
In-Depth Information
In case you are thinking this is a rather paltry plume of smoke, you should remember the number of
zombie bunnies that could be going up in smoke at any one time. Let's get the smoke added to the
hit sequence next. Because the smoke is from the toasted zombie, it should be instantiated from the
ZombieBunny's ReceivedHit script.
1.
Uncheck Looping again.
2.
Drag the Smoke object into the Prefabs' FX folder in the Project view, and
delete it in the Hierarchy view.
3.
Open the ReceivedHit script.
4.
Add the following variable:
public GameObject smokePlume; // smoke particle system
In the DestroyBun function, below the Destroy(dead,1f) line, add the
following:
5.
GameObject plume = (GameObject) Instantiate(smokePlume, transform.position, smokePlume.
transform.rotation);
// trigger it to be destroyed at its end/Duration + max lifetime
Destroy(plume,10f);
6.
Save the script.
7.
Select the ZombieBunny prefab in the Project view, and drag the Smoke
prefab onto its Smoke Plume parameter.
8.
Click Play, and test the new effect.
The smoke drifts up, enhancing the sequence (Figure 8-29 ).
Search WWH ::




Custom Search