Game Development Reference
In-Depth Information
monument gives the user this final flag to complete the mission) as shown in
the following code:
m.tokens.AddRange
(missionManager.missions[0].tokens);
Creating the flag Prefabs
As this mission revolves around finding state flags, let's build a generic Prefab that
we can texture with different flag imagery, creating a database of objects to choose
from.
1. To get started, let's create a cylinder and set it's scale to (
0.5
,
3.2
,
0.5
).
Create a dark-grey material, and apply it to the cylinder and name it
Pole
.
2. Create a sphere, scale it to (
1.5
,
0.2
,
1.5
). Place it on top of the pole and
parent it to the cylinder object. Create a yellow material and apply it to the
texture as seen in the following screenshot:
3. Create an interactive cloth object, and orient it by 270 degrees on the
x
axis.
Scale it to (
1, 0.3, 0.08
). Parent it to the pole, and set its local position
to (
5.8, 0.4, 0
). This is a GameObject with script attached that simulates
the natural motion of cloth under the influence of external forces. We will use
this to build nice-looking flags for the states that respond to gravity, wind, and
the player's interactions.