logo资料库

Getting Started with Unity 5.X 2D Game Development 无水印pdf.pdf

第1页 / 共472页
第2页 / 共472页
第3页 / 共472页
第4页 / 共472页
第5页 / 共472页
第6页 / 共472页
第7页 / 共472页
第8页 / 共472页
资料共472页,剩余部分请下载后查看
Cover
Copyright
About the Author
Table of Contents
Preface
1: A Flat World in Unity
Learning game development
Tower defense games
Designing our game
Getting ready
Remembering the past to build the future
Organizing the project
A 2D world
Sprites
Sprite Renderer
Importing new friends
The Sprite Editor
Manual mode
Automatic mode
Polygonal mode
Sprite Editor for UI-9-slice scaling
Preparing the assets
Scenes as levels
Setting proportions
There is more about the Unity interface
Homework
Summary
2: Baking Cupcake Towers
2D objects
Parenting game objects
Difference between world coordinates and local coordinates
Ordering the different layers with Z-Buffering
Unfolding the map
Layers and tags
Prefabs
The game view
Math background
Scripting in Unity
Creating new scripts
Basics about scripts
Variables
Attributes
Functions
Comments
Execution order
Making sprinkles
The projectile class
Scripting the projectile mother class
Tons of sprinkles through Prefabs
Baking cupcakes towers
What a cupcake tower does
Scripting the cupcake tower
Shooting to the pandas
Upgrading the cupcake tower, making it even tastier
A pre-baked cupcake tower through Prefabs
More about coding in Unity
Static variables
Inheritance
Random numbers in Unity
Homework
Summary
3: Communicating with the Player – the User Interface
Getting ready
Designing the user interface
Programming the user interface
User interface system
Canvas
Screen space – Overlay
Screen space – Camera
World space
Draw order of UI elements
Visual components
The Image component
The Text component
Basic transformations
The Rect Tool
The Rect Transform
Layout components
Fitters
Layout groups
The layout element component
Interaction components
The selectable base class
Interactable option
Transition options
Navigation options
Button
Toggle and Toggle Group
Slider
Scrollbar
Dropdown
Input Field
Scroll Rect
More about UI rendering
The canvas renderer
More visual components
UI effect components
UI and lights
The canvas components
Canvas group
Event system
Scripting user interfaces
Designing the interface for our game
Preparing the scene for the UI
Creating a health bar
Creating and placing the health bar
Scripting the health bar
Implementing the sugar meter
Creating and place
Scripting the sugar meter
More about UI scripting – handlers
What about all the rest?
Homework
Summary
4: No Longer Alone – Sweet-Toothed Pandas Strike
Getting ready
Animations
A historical overview
Animations in video games
Workflow for animations
Animations clips and the Animator component
Creating Animation clips with a controller
The Animator component
Creating the other animation clips
The Animator
The Animator window
The Animator state machine
The Animator states
Special states
The animator parameters
The animator transitions
Transition settings
Transition graph
Transition conditions
Testing transitions
The panda's Animation State Machine
Testing the panda's Animation State Machine
Scripting Animations
State machine behaviours
The destroy behaviour
The panda script
More about Animations
Avatars
Sub-state machines
The hierarchical location menu
Layers in the Animator
Blending trees
Animator Override Controller
Culling Mode in the Animator component
Root motion
Inverse Kinematic
Animator component information box
Legacy animation
Get animated!!
Homework
Summary
5: The Secret Ingredient Is a Dash of Physics
Getting ready
Physics in video games
Physics – basics
World coordinates and local coordinates
Velocity
Mass
Centre of mass
Kinematics
Dynamics
Force and torque
Collisions
Rigid body
Friction – linear and angular drag
The Unity Physics engine
Understanding Physics in Unity
Physics settings in Unity
Physics components
Rigidbodies
How a Rigidbody 2D works
Body types
Rigidbody properties
Dealing with rigidbodies
Colliders
Dealing with colliders
Joints
Main properties of Joints
The other rigidbody
Breaking joints
Specific joints
Distance Joint 2D
Fixed Joint 2D
Friction Joint 2D
Hinge Joint 2D
Relative Joint 2D
Slider Joint 2D
Spring Joint 2D
Target Joint 2D
Wheel Joint 2D
Effectors
Constant Force 2D
Area Effector 2D
Buoyancy Effector 2D
Point Effector 2D
Platform Effector 2D
Surface Effector 2D
Physics Material 2D
Dealing with physics in Unity
Other things about Physics
The Simulate setting on rigidbodies
Physics Raycaster 2D component
The other Physics settings
Gizmos for colliders
Physics for our game
Set up Pandas as a rigidbodies
Set up projectiles as rigidbodies
Detect sprinkles
Homework
Summary
6: Through a Sea of Sprinkles – Navigation in Artificial Intelligence
Getting ready
Introduction to artificial intelligence
The importance of artificial intelligence in video games
Navigation
Aspects of navigation
Pathfinding and its techniques
Waypoints for enemies
Getting the waypoint coordinates
Implementing waypoints – the first/static way
Implementing waypoints in the Game Manager
Moving along the designed path – static
Implementing waypoints – the second/dynamic way
Implementing waypoints as separate entities
Moving along the designed path – dynamic
More about artificial intelligence in games
Other techniques for navigation at the pathfinding level
Navigation at the level of steering behaviours
Navigation at the level of pathfinding/decision making – belief-driven pathfinding
Beyond navigation
Homework
Summary
7: Trading Cupcakes and the Ultimate Battle for the Cake – Gameplay Programming
Getting ready
What does gameplay programming mean?
Planning what is left to implement for our game
Trading cupcake towers
The trading parent class
Modifying the CupcakeTowerScript
Buying cupcake towers
Selling cupcake towers
Upgrading cupcakes towers
Adding the trading options to the user interface
Placing the towers
Sketching the idea of how it works
Allowed areas
Scripting the placement script
Selecting the towers
The Game Manager
Game over conditions
Game over feedback
The GameOver function
Keeping track of the game's progress
Panda invasion – spawning Pandas
What is a coroutine?
Sketching the idea of how it works
Setting up the spawning system
Managing waves
The single wave
The main menu
Designing the main menu
Creating the main menu in another scene
Loading scenes through scripts
Techniques we learnt in this chapter
Homework
Summary
8: What Is beyond the Cake?
Enhancing and improving your game
Improving cupcake towers
Shooting policies
Special sprinkles
Aging and pricing model
Improving the user interface
Improving levels
Multilevel
Large maps
Many paths
Many Pandas
Multiphase bosses
A better spawning system
Switching difficulty at runtime
Training and extending your Unity skills to become a better game developer
Making things easier for other team members
Exposing events
Sprinkles pooling
Saving your data
Debugging
Remote Logs
Cleaning the release version
More about communication between scripts
Documenting the code
Protecting your game
Building for more than one platform
Input/output devices
Virtual reality in Unity
Balancing the game
Extending the Unity editor
Multiplayer and networking
Practice makes perfect
Improving the atmosphere of the game
Visuals
Color schemes
Homework
Lighting
Lights in Unity
Homework
Environment
Homework
Special effects
Particle systems
Post processing
Other visual effects
Audio
Music
Sound effects
Eliciting emotions
Homework
Audio in Unity
External audio systems
Teamwork
It is not just about you, it is about working in a team
Sharing a common vision
Managing expectations
Collaboration and communication are key
Ways to communicate
Version control
Make a GDD and stick to it
Keeping it tidy with project management tools
Slack
HacknPlan
Drive
Dropbox
Trello
Redbooth
GitHub
BitBucket
Calendar
Pinterest
Hootsuite
Polishing your game
Processing the power
Checking the build size
Texture optimitation
Stats and profiling
Other optimization tips
Playtesting
Why are you even playtesting?
Exercise
Whom do you need to playtest?
The solo test run
Making it a social occasion
Putting it within boundaries
Reaching out to family and friends
Those who are strangers
Those who you want to play your game
When
Where
What
A little goes a long way
How
Methods of playtesting
Observe
Question and explain
Reflect and follow up
Creating your online presence
Do your research
Conducting an audit
Engaging with your audience
Rewarding engagement
Marketing on social media
Blog about it
Twitter
Exercise
Instagram
Facebook
MailChimp
Getting ready to publish
Crowdfunding campaigns
Building in Unity
Clearing the air
Accepting terms and conditions
Localization
Ethical considerations
Summary
Final notes and goodbye
Index
Getting Started with Unity 5.x 2D Game Development Build a tower defense game and earn delectable C# treats by baking cupcakes and fighting fearsome sweet-toothed pandas Francesco Sapio BIRMINGHAM - MUMBAI
Getting Started with Unity 5.x 2D Game Development Copyright © 2017 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: February 2017 Production reference: 1080217 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78439-717-3 www.packtpub.com
Credits Author Francesco Sapio Reviewer Lauren S. Ferro Copy Editors Vikrant Phadkay Safis Editing Project Coordinator Nidhi Joshi Commissioning Editor Ashwin Nair Proofreader Safis Editing Acquisition Editor Larissa Pinto Indexer Mariammal Chettiyar Content Development Editor Mayur Pawanikar Production Coordinator Aparna Bhagat Technical Editor Dinesh Pawar  
About the Author Francesco Sapio obtained his computer science and controls engineering degree from Sapienza University of Rome, Italy, with a couple of semesters in advance, graduating summa cum laude; he is currently studying there for a master's of science and engineering degree in artificial intelligence and robotics. He is a Unity 3D and Unreal expert, skilled game designer, and experienced user of major graphics programs. He developed Game@School (Sapienza University of Rome), an educational game for high-school students to learn concepts of physics, and the Sticker Book series (Dataware Games), a cross-platform series of games for kids. In addition, he worked as consultant for the (successfully funded by Kickstarter) game Prosperity – Italy 1434 (Entertainment Game Apps, Inc) and for the open online collaborative ideation system titled Innovoice (Sapienza University of Rome). Moreover, he has been involved in different research projects such as Belief-Driven Pathfinding (Sapienza University of Rome), which is a new technique of path finding in video games that was presented as a paper at the DiGRA- FDG Conference 2016; and perfekt.ID (Royal Melbourne Institute of Technology), which included developing a recommendation system for games. Francesco is an active writer on the topic of game development. Recently, he authored the book Unity UI Cookbook, Packt Publishing. It teaches readers how to develop exciting and practical user interfaces for games within Unity, and he wrote a short e-guide, What do you need to know about Unity, Packt Publishing. In addition, he co-authored the book Unity 5.x 2D Game Development Blueprints, Packt Publishing, which has also been transformed in the video course Unity 5.x Game Development Projects, Pack Publishing. He has also been a reviewer for the following books: Game Physics Cookbook, Packt Publishing, Unity 5.x by Example, Packt Publishing, and Unity Game Development Scripting, Packt Publishing. Francesco is also a musician and a composer, especially of soundtracks for short films and video games. For several years, he worked as an actor and dancer, where he was a guest of honor at the Teatro Brancaccio in Rome. In addition, he has volunteered as a children's entertainer at the Associazione Culturale Torraccia in Rome. Finally, Francesco loves math, philosophy, logic, and puzzle solving, but most of all, creating video games—thanks to his passion for game designing and programming. You can contact him at www.francescosapio.com.
Acknowledgment I'm deeply thankful to my parents for their infinite patience, enthusiasm, and support throughout my life. Moreover, I'm thankful to the rest of my family, in particular to my grandparents, since they have always encouraged me to do better in my life with the Latin expressions Ad maiora and Per aspera ad astra. I also want to thank Lauren S. Ferro, the reviewer, for her fantastic feedback and help, which have enhanced the quality of this book. Another important person, without whom this book couldn't have seen the light, is Mayur Pawanikar, the content development editor, who supported me throughout the whole process. Finally, a huge thank to all the special people around me whom I love. In particular to my girlfriend: I'm grateful for all of your help in everything, I love you.
About the Reviewer Lauren S. Ferro is a gamification consultant and designer of game and game-like applications. She has worked, designed, consulted, and implemented strategies for a range of different purposes from professional development, recommendation systems, and educational games. She is an active researcher in the area of gamification, player profiling, and user-centered game design. Lauren runs workshops both for the general public and companies that focus on designing user-centered games and game-like applications. She has written a book about implementing gamification within Unity titled Gamification with Unity 5.x and is the developer of the game design resource Gamicards, which is a paper prototyping tool for both game and game-like experiences.
www.PacktPub.com For support files and downloads related to your book, please visit www.PacktPub.com. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. h t t p s ://w w w . p a c k t p u b . c o m /m a p t Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career. Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content On demand and accessible via a web browser
分享到:
收藏