Game Development Reference
In-Depth Information
6.
Multiply the new rate based on the player character's position by the
rateIncrease value that you can use in the Inspector to adjust how rapidly
the startSpeed value changes as the player moves within the zone, then
assign it to the Blizzard game object's particle system Start Speed property.
Save the script and attach to the Blizzard game object. Back in the editor, select the Blizzard game
object in the Hierarchy, then drag the Third Person Character Ragdoll from the Hierarchy to the
Player Transform field of the Blizzard Zone script in the Inspector. Playtest and note the change in
snowflake speeds as the player runs around. In addition to adjusting initial particle system properties
in the Inspector, you can easily control them during gameplay. MonoDevelop's autofill function can
assist you by displaying the available particle system properties (Figure 10-14 );
Figure 10-14. Particle system properties displayed in MonoDevelop's autofill pop-up window
Don't forget to add the cheat code for this zone to the RelocatePlayer() function of the Cheats
script:
else if(Input.GetKey(KeyCode.Alpha6)) {
relocationPoint = Vector3(0, 9, 108);
RelocatePlayer();
}
Have fun experimenting with altering different particle system properties or even multiple properties
based on player progression. When you have the Blizzard zone the way you like it, save the script,
the scene, and the project.
Enemy Zone
In this zone you are graduating from hazards to an enemy that has enough intelligence to direct an
attack on the player. You will create a simple drone enemy that targets and chases after the player
while the player is in its zone.
To create the enemy drone, open the Assets ➤ Prefab folder and drag a land mine prefab onto
the Scene view. Rename it Enemy Drone in the Hierarchy, then in the Inspector give it a Transform
position of (0, 10, 145). The Land Mine prefab already explodes on contact with the player character,
so the only thing to add here is the ability to find the player character and hunt him down.
 
Search WWH ::




Custom Search