售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Mastering Unity Scripting
Table of Contents
Mastering Unity Scripting
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Unity C# Refresher
Why C#?
Creating script files
Instantiating scripts
Variables
Conditional statements
The if statement
The switch statement
Arrays
Loops
The foreach loop
The for loop
The while loop
Infinite loops
Functions
Events
Classes and object-oriented programming
Classes and inheritance
Classes and polymorphism
C# properties
Commenting
Variable visibility
The ? operator
SendMessage and BroadcastMessage
Summary
2. Debugging
Compilation errors and the console
Debugging with Debug.Log – custom messages
Overriding the ToString method
Visual debugging
Error logging
Editor debugging
Using the profiler
Debugging with MonoDevelop – getting started
Debugging with MonoDevelop – the Watch window
Debugging with MonoDevelop – continue and stepping
Debugging with MonoDevelop – call stack
Debugging with MonoDevelop – the Immediate window
Debugging with MonoDevelop – conditional breakpoints
Debugging with MonoDevelop – tracepoints
Summary
3. Singletons, Statics, GameObjects, and the World
The GameObject
Component interactions
GetComponent
Getting multiple components
Components and messages
GameObjects and the world
Finding GameObjects
Comparing objects
Getting the nearest object
Finding any object of a specified type
Clearing a path between GameObjects
Accessing object hierarchies
The world, time, and updates
Rule #1 – frames are precious
Rule #2 – motion must be relative to time
Immortal objects
Understanding singleton objects and statics
Summary
4. Event-driven Programming
Events
Event management
Starting event management with interfaces
Creating an EventManager
Code folding in MonoDevelop with #region and #endregion
Using EventManager
Alternative with delegates
MonoBehaviour events
Mouse and tap events
Application focus and pausing
Summary
5. Cameras, Rendering, and Scenes
Camera gizmos
Being seen
Detecting the object visibility
More on the object visibility
Frustum testing – renderers
Frustum testing – points
Frustum testing – occlusion
Camera vision – front and back
Orthographic cameras
Camera rendering and postprocessing
Camera shake
Cameras and animation
Follow cameras
Cameras and curves
Camera paths – iTween
Summary
6. Working with Mono
Lists and collections
The List class
The Dictionary class
The Stack class
IEnumerable and IEnumerator
Iterating through enemies with IEnumerator
Strings and regular expressions
Null, empty strings, and white space
String comparison
String formatting
String looping
Creating strings
Searching strings
Regular expressions
Infinite arguments
Language Integrated Query
Linq and regular expressions
Working with Text Data Assets
Text Assets – static loading
Text Assets – loading from the local files
Text Assets – loading from the INI files
Text Assets – loading from the CSV files
Text Assets – loading from the Web
Summary
7. Artificial Intelligence
Artificial Intelligence in games
Starting the project
Baking a navigation mesh
Starting an NPC agent
Finite State Machines in Mecanim
Finite State Machines in C# – getting started
Creating the Idle state
Creating the Patrol state
Creating the Chase state
Creating the Attack state
Creating the Seek-Health (or flee) state
Summary
8. Customizing the Unity Editor
Batch renaming
C# attributes and reflection
Color blending
Property exposing
Localization
Summary
9. Working with Textures, Models, and 2D
Skybox
Procedural meshes
Animating UVs – scrolling textures
Texture painting
Step 1 – creating a texture blending shader
Step 2 – creating a texture painting script
Step 3 – setting up texture painting
Summary
10. Source Control and Other Tips
Git – source control
Step #1 – downloading
Step #2 – building a Unity project
Step #3 – configuring Unity for source control
Step #4 – creating a Git repository
Step #5 – ignoring files
Step #6 – creating the first commit
Step #7 – changing files
Step #8 – getting files from the repo
Step #9 – browsing the repo
Resources folder and external files
AssetBundles and external files
Persistent data and saved games
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜