Unity Game Development Scripting
eBook - ePub

Unity Game Development Scripting

Kyle D'Aoust

Compartir libro
  1. 202 páginas
  2. English
  3. ePUB (apto para móviles)
  4. Disponible en iOS y Android
eBook - ePub

Unity Game Development Scripting

Kyle D'Aoust

Detalles del libro
Vista previa del libro
Índice
Citas

Información del libro

The intuitive and powerful Unity game engine is one of the most widely used and best loved packages for game development. Unity scripting is an essential but challenging skill to master in order to create custom game elements. Learning modular scripting allows you to rewrite as little code as possible as you deploy your scripts to multiple projects and work easier, quicker, and more efficiently than before.

In each chapter of this book, you'll learn how to script new game elements. Beginning with making custom controls for the keyboard and mouse, as well as the Xbox 360 Controller, you'll then get to grips with more complex systems such as inventory, data saving, and artificial intelligence. As you create these elements, you'll also learn how to make your scripts simpler and easy to use. This will allow drag-and-drop deployment, which is to be used by designers and nonprogrammers. Finally, you'll combine all of your newfound skills to create your own complete game project.

Preguntas frecuentes

¿Cómo cancelo mi suscripción?
Simplemente, dirígete a la sección ajustes de la cuenta y haz clic en «Cancelar suscripción». Así de sencillo. Después de cancelar tu suscripción, esta permanecerá activa el tiempo restante que hayas pagado. Obtén más información aquí.
¿Cómo descargo los libros?
Por el momento, todos nuestros libros ePub adaptables a dispositivos móviles se pueden descargar a través de la aplicación. La mayor parte de nuestros PDF también se puede descargar y ya estamos trabajando para que el resto también sea descargable. Obtén más información aquí.
¿En qué se diferencian los planes de precios?
Ambos planes te permiten acceder por completo a la biblioteca y a todas las funciones de Perlego. Las únicas diferencias son el precio y el período de suscripción: con el plan anual ahorrarás en torno a un 30 % en comparación con 12 meses de un plan mensual.
¿Qué es Perlego?
Somos un servicio de suscripción de libros de texto en línea que te permite acceder a toda una biblioteca en línea por menos de lo que cuesta un libro al mes. Con más de un millón de libros sobre más de 1000 categorías, ¡tenemos todo lo que necesitas! Obtén más información aquí.
¿Perlego ofrece la función de texto a voz?
Busca el símbolo de lectura en voz alta en tu próximo libro para ver si puedes escucharlo. La herramienta de lectura en voz alta lee el texto en voz alta por ti, resaltando el texto a medida que se lee. Puedes pausarla, acelerarla y ralentizarla. Obtén más información aquí.
¿Es Unity Game Development Scripting un PDF/ePUB en línea?
Sí, puedes acceder a Unity Game Development Scripting de Kyle D'Aoust en formato PDF o ePUB, así como a otros libros populares de Computer Science y Entreprise Applications. Tenemos más de un millón de libros disponibles en nuestro catálogo para que explores.

Información

Año
2014
ISBN
9781783553631
Edición
1

Unity Game Development Scripting


Table of Contents

Unity Game Development 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
Errata
Piracy
Questions
1. Interactive Input
Picking the controls
Mapping the needed controls
Checking the input manager
Checking the Xbox 360 Controller inputs
Adding additional controller inputs
Adding a start button and trigger inputs
Adding directional pad inputs
Adding PC control inputs
Housing our control script
Creating and naming the script
Formatting the script
Creating the device detector
Adding the variables needed
Creating the detection function
Creating the identifier function
Let's get set and show them
Adding variables for each control
Adding a function to display the variables
Let's switch!
Creating control profiles
Adding a profile switching function
Adding the GUI interaction function
Customization is key
Swapping control schemes
Adding a control switch button to the GUI
Cycling control inputs
Adding the controls pop up to the GUI
Resetting the controls
Adding the Reset function
Adding the Reset input
Playtesting
Summary
2. GUI Time
A traditional 2D UI
Setting up our scene
Housing our 2D UI
Creating GUI buttons
Creating a health bar
Level counter
Creating an experience counter
Housing our 3D UI
Creating a 3D health bar
Creating 3D damage reports
The new Update function
Completing the damage reports
Creating 3D name tags
Summary
3. Expandable Item Classes
The self item class
Adding our variables
Buff or debuff stats
The health changer
The armor changer
The item activator
The melee item class
Adding our variables
Buff or debuff stats
The health changer
Let's interact with the environment
Detecting triggers
The projectile item class
Adding our variables
Buff or debuff stats
The health changer
Adding movement
Detecting triggers
Playtesting
Summary
4. Inventory
Features of an inventory
Limits of the inventory
Accessing the inventory
Organizing an inventory
Item count modifications
Item bartering
Dropping and picking up items
Destroying and using items
Displaying the inventory
Creating the inventory script
Creating and naming the script
Adding the necessary variables
Initializing our inventory
Creating the initializer
Adding items
Let's figure this out
Creating the adding function
Removing items
Let's figure this out
Creating the removing function
Setting the quick-select items
Setting the quick-select items quickly
Let's display the inventory
Using our custom inputs
Displaying the GUI
Running the GUI
Playtesting
Creating a test scene
Let's add an item
Let's remove some items
Other things to try out
Summary
5. Enemy and Friendly AIs
AI techniques
Finite state machines
The behavior tree form of the AI system
Combining the techniques
Let's start scripting!
Internal and external actions
External actions
Internal actions
Scripting the actions
Pathfinding
Creating paths using the waypoint system
Unity's NavMesh system
Setting up the environment
Creating the NavMesh
Adding our variables
Scripting the navigation functions
Character animations
Importing the model mesh
Scripting the animations
Putting it all together
Final coding touches
Filling out the inspector
Playtesting
Summary
6. Keeping Score
Prototype stats
Assigning the stats to the player
The stat tracker
Setting the stats
Resetting the stats
Resetting all of our prefs
Saving all of our prefs
Setting a specific pref
Resetting a specific pref
Showing our stats on the screen
The achievement system
Prototyping the achievements
Adding the required achievement variables
Resetting the achievements
Achievement trackers
Tracking the kills
Tracking the gold total
Tracking the gold spent
Tracking the player's level
Tracking the rounds won
Tracking the time played
Let's check the achievements
Checking a specific achievement
Checking all of the achievements
Displaying the achievements on screen
Adding the GUI functions
Playtesting
Summary
7. Creating Save and Load Systems
Saving data with flat files
Adding the required variables
Time to save our file
Deleting our flat files
Loading our flat files
Time to load our file
The XML save system
Creating our XML files
Saving data with XML
Adding the required variables
Saving the player data
Saving the enemy data
Loading data with XML
Loading the player data
Loading the enemy data
Creating the SaveHandler script
The checkpoint system
The save anywhere-anytime system
Playtesting
Summary
8. Aural Integration
Background music
Creating a random system
Adding a playlist system
Implementing the audio systems
Atmospheric sounds
Creating the script and variables
Initializing the variables
Playing the atmospheric sounds
Sound effects
Creating the script and variables
Playtesting
Summary
9. Game Settings
Figuring out what to optimize
Making video configurations
Setting the values
Toggling the shadows
Setting the field of view
Setting the resolution
Toggling the anti-aliasing property
Setting vsync
Changing the quality settings
Loading the settings
Making audio configurations
Setting the values
Configuring the volumes
Setting the speaker mode
Creating the settings menu
Preparing the code
Creating the GUI
Saving all the values
Loading all the values
Playtesting
Summary
10. Putting It All Together
Creating levels
The main menu
The playable level
Creating player interactions
Shooting and pausing
Collecting potions
Adding all the sounds
Playing the background music
Adding the atmospheric sounds
Implementing the GUI ...

Índice