Game Development Reference
In-Depth Information
If your project is a combination of 2D and 3D, you easily access the features when and if you need
them. The two major changes are textures imported as Sprite types and the Scene view set to 2D.
Scene 2D is an iso view facing the Z. This sets you up for X horizontal and Y vertical, the standard
2D coordinate system. Additionally, because Unity deals with 3D space, you can use the Z depth to
order 2D Sprites and other 2D elements.
After importing the sprite textures, you will be handling the 2D features manually so you can easily
switch between the 2D and 3D parts of the game.
Sprite Assets
The featured asset for any 2D display, whether for a full-fledged game or simple HUD, is the sprite
texture. This image is treated differently than textures used for 3D materials. It does not require MIP
mapping, as it never is displayed back into 3D space. As with textures used for objects with multiple
parts or even multiple objects, sprite textures are quite often altased , or grouped together on a single
texture sheet.
Your first sprite will contain the images used for the battery's charge or health. The texture sheet will
contain the outline of the battery icon and the solid part that will indicate the charge remaining. You
are already calculating the percentage. With this HUD, you will be animating the amount and color
though scripting.
1.
Copy and paste the 2D Assets folder from the topic's Chapter 9 Assets folder
into the new folder.
2.
In the 2 x 3 Layout, switch to the Two Columns Layout to see the thumbnails
of the new additions.
The folder contains four texture sheet-type images. Imported in 3D mode, they will appear as shown
in Figure 9-6 , where it has not been assumed that the alpha channel is used for transparency.
Figure 9-6. The new textures for the game's 2D assets imported in 3D mode
3.
Select the Battery texture in the Inspector.
4.
Check out its diffuse and alpha components (Figure 9-7 , left and center).
 
Search WWH ::




Custom Search