Learning C# 7 By Developing Games with Unity 2017 - Third Edition [3 ed.]
1788478924, 9781788478922
Do you want to learn C# programming by creating fun and interactive games using the latest Unity 2017 platform? If so, l
428
32
7MB
English
Pages 290
Year 2017
Report DMCA / Copyright
DOWNLOAD EPUB FILE
Table of contents :
1: Discovering Your Hidden Scripting Skills and Getting Your Environment Ready
Prerequisite knowledge to use this book
Dealing with scriptphobia
Downloading Unity
Teaching behavior to GameObjects
C# documentation – where to find it and do I need it at all?
Working with C# script files
Creating a C# script file
Introducing the MonoDevelop code editor
Instance? What is this?
Summary
2: Introducing the Building Blocks for Unity Scripts
Understanding what a variable is and what it does
What is a method?
Introducing the class
The Start(), Update(), and Awake() methods, and the execution order
Components that communicate using dot syntax
Making decisions in code
Pencil and paper are powerful tools
Summary
3: Getting into the Details of Variables
Writing C# statements properly
Understanding component properties in Unity's Inspector
Changing a property's value in the Inspector panel
Private variables
Naming your variables properly
Beginning variable names with lowercase
Using multiword variable names
Declaring a variable and its type
Assigning values while declaring a variable
Where you declare a variable is important
Variable scope - determining where a variable can be used
Summary
4: Getting into the Details of Methods
Using methods in a script
Naming methods properly
Defining a method the right way
Understanding parentheses - why are they there?
Specifying a method's parameters
Returning a value from a method
Summary
5: Lists, Arrays, and Dictionaries
What is an array?
Storing items in the List
List versus arrays
Retrieving the data from the Array or List
ArrayList
Dictionaries
Summary
6: Loops
Introduction to loops
The foreach loop
The for loop
The while loop
while versus for loops
Loops in statements
Modulo
Searching for data inside an array
Breaking the loop
Summary
7: Object, a Container with Variables and Methods
Working with objects is a class act
Instantiating an object
Bored yet?
Using methods with objects
Custom constructors
Overloading
Summary
8: Let's Make a Game! – from Idea to Development
Your first game – avoiding the trap of the never–ending concept
What do I need to learn before I start creating my own game?
Game mechanics and core components
Breaking the concept into smaller parts
Testing the mechanics
Target platform and resolution
Target screen resolution
Summary
9: Starting Your First Game
Setting up a new Unity project for our game
Preparing the player prefab
PlayerController
User input
Animator
Code
Summary
10: Writing GameManager
Gameplay loops
Singleton class
Starting the game
Setting up input keys
Using triggers
Restarting the game
Setting up the player starting position
Code in this chapter
Summary
11: The Game Level
Designed levels versus generated levels
Creating a designed level
Creating a generated level
Creating a copy of the level piece
Instantiating
Vector3
Testing LevelGenerator
Extending the level
The code used in this chapter
Summary
12: The User Interface
Introducting the Unity UI
Views
Buttons
Hiding and showing the Canvas
Reference exceptions
GameView
The code in this chapter
Summary
13: Collectables
Collectables
The coin prefab
High score and persisting data
Health Points and Health bar
Magic Points and Magic bar
The code in this chapter
Summary
14: Enemies
What makes an enemy?
Movement
The code in this chapter
Summary
15: Audio, 3D Games, and Export
How to add sound effects and music
How to create a 3D game
How to export and make it playable
Code
Summary