𝔖 Scriptorium
✦   LIBER   ✦

📁

Learning C# by developing games with Unity 2020 : an enjoyable and intuitive approach to getting started with C# programming and Unity

✍ Scribed by Harrison Ferrone


Year
2020
Tongue
English
Leaves
356
Edition
Fifth
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Table of Contents


Cover
Title Page
Copyright and Credits
Dedication
About Packt
Contributors
Table of Contents
Preface
Chapter 1: Getting to Know Your Environment
Technical requirements
Getting started with Unity 2020
Using macOS 
Creating a new project
Navigating the editor
Using C# with Unity 
Working with C# scripts
Introducing the Visual Studio editor
Time for action – opening a C# file
Beware of naming mismatches
Syncing C# files
Exploring the documentation
Accessing Unity's documentation
Time for action – opening the Reference Manual
Time for action – using the Scripting Reference
Locating C# resources
Time for action – looking up a C# class
Summary
Pop quiz – dealing with scripts
Chapter 2: The Building Blocks of Programming
Defining variables
Names are important
Variables act as placeholders
Time for action – creating a variable
Time for action – changing a variable's value
Understanding methods
Methods drive actions
Methods are placeholders too
Time for action – creating a simple method
Introducing classes
A common Unity class
Classes are blueprints
Working with comments
Practical backslashes
Multi-line comments
Time for action – adding comments
Putting the building blocks together
Scripts become components
A helping hand from MonoBehavior
Hero's trial – MonoBehavior in the Scripting API
Communication among classes
Summary
Pop quiz – C# building blocks
Chapter 3: Diving into Variables, Types, and Methods
Writing proper C#
Debugging your code
Declaring variables
Type and value declarations
Type-only declarations
Using access modifiers
Choosing a security level
Time for action – making a variable private
Working with types
Common built-in types
Time for action – playing with different types
Time for action – creating interpolated strings
Type conversions
Inferred declarations
Custom types
Types roundup
Naming variables
Best practices
Understanding variable scope
Introducing operators
Arithmetic and assignments
Time for action – executing incorrect type operations
Defining methods
Basic syntax
Modifiers and parameters
Time for action – defining a simple method
Naming conventions
Methods are logic detours
Specifying parameters
Time for action – adding method parameters
Specifying return values
Time for action – adding a return type
Using return values
Time for action – capturing return values 
Hero's trial – methods as arguments
Dissecting common Unity methods
The Start method
The Update method
Summary
Pop quiz – variables and methods
Chapter 4: Control Flow and Collection Types
Selection statements
The if-else statement
Basic syntax
Time for action – thieving prospects
Using the NOT operator
Nesting statements
Evaluating multiple conditions
Time for action – reaching the treasure
The switch statement
Basic syntax
Pattern matching
Time for action – choosing an action
Fall-through cases
Time for action – rolling the dice
Pop quiz 1 – if, and, or but
Collections at a glance
Arrays
Basic syntax
Indexing and subscripts
Range exceptions
Lists
Basic syntax
Time for action – party members
Common methods
Dictionaries 
Basic syntax
Time for action – setting up an inventory
Working with dictionary pairs
Pop quiz 2 – all about collections
Iteration statements
For loops
Time for action – finding an element
foreach loops
Looping through key-value pairs
Hero's trial – finding affordable items
while loops
Time for action – tracking player lives
To infinity and beyond
Summary
Chapter 5: Working with Classes, Structs, and OOP
Defining a class 
Basic syntax
Time for action – creating a character class
Instantiating class objects
Time for action – creating a new character
Adding class fields
Time for action – fleshing out character details
Using constructors
Time for action – specifying starting properties
Declaring class methods
Time for action – printing out character data
Declaring structs
Basic syntax
Time for action – creating a weapon struct
Understanding reference and value types
Reference types
Time for action – creating a new hero
Value types
Time for action – copying weapons
Integrating the object-oriented mindset
Encapsulation
Time for action – adding a reset
Inheritance
Base constructors
Time for action – calling a base constructor
Composition
Polymorphism
Time for action – functional variations
OOP roundup
Applying OOP in Unity
Objects are a class act
Accessing components
Basic syntax
Time for action – accessing the current transform component
Time for action – finding components on different objects
Drag and drop
Time for action – assigning variables in Unity
Summary
Pop quiz – all things OOP
Chapter 6: Getting Your Hands Dirty with Unity
A game design primer
Game design documents
The Hero Born one-page
Building a level
Creating primitives
Time for action – creating a ground plane
Thinking in 3D
Materials
Time for action – changing the ground color
White-boxing
Editor tools
Hero's trial – putting up drywall
Keeping the hierarchy clean
Time for action – using empty objects
Working with prefabs
Time for action – creating a turret
Time for action – updating the prefab
Time for action – finishing the level
Hero's trial – creating a health pickup
Lighting basics
Creating lights
Light component properties
Animating in Unity
Creating clips
Time for action – creating a new clip
Recording keyframes
Time for action – spinning animation
Curves and tangents
Time for action – smoothing the spin
The particle system
Time for action – adding sparkle effects
Summary
Pop quiz – basic Unity features
Chapter 7: Movement, Camera Controls, and Collisions
Moving the player
Player setup
Time for action – creating the player capsule
Understanding vectors
Getting player input
Time for action – player locomotion
Adding a following Camera
Time for action – scripting camera behavior
Working with Unity physics
Rigidbody components in motion
Time for action – accessing the Rigidbody component
Time for action – moving the Rigidbody component
Colliders and collisions
Time for action – picking up an item
Using Collider triggers
Time for action – creating an enemy
Time for action – capturing trigger events
Hero's trial – all the prefabs!
Physics roundup
Summary
Pop quiz – player controls and physics
Chapter 8: Scripting Game Mechanics
Adding jumps
Introducing enumerations 
Underlying types
Time for action – pressing the spacebar to jump!
Working with layer masks
Time for action – setting object layers
Time for action – one jump at a time
Shooting projectiles
Instantiating objects
Time for action – creating a projectile prefab
Time for action – adding the shooting mechanic
Managing GameObject buildup
Time for action – destroying bullets
Creating a game manager
Tracking player properties
Time for action – creating a game manager
The get and set properties
Time for action – adding backing variables
Time for action – updating item collection
Adding player polish
Graphical UI
Time for action – adding UI elements
Win and loss conditions
Time for action – winning the game 
Using directives and namespaces
Time for action – pausing and restarting 
Summary
Pop quiz – working with mechanics
Chapter 9: Basic AI and Enemy Behavior
Navigating in Unity
Navigation components
Time for action – setting up the NavMesh
Time for action – setting up enemy agents
Moving enemy agents
Procedural programming
Time for action – referencing the patrol locations 
Time for action – moving the enemy
Time for action – patrolling continuously between locations
Enemy game mechanics
Seek and destroy
Time for action – changing the agent's destination
Time for action – lowering player health
Time for action – detecting bullet collisions
Time for action – updating the game manager
Refactoring and keeping it DRY
Time for action – creating a restart method
Hero's trial – refactoring win/lose logic
Summary
Pop quiz – AI and navigation
Chapter 10: Revisiting Types, Methods, and Classes
Access Modifier redux
Constant and read-only properties
Using the static keyword 
Time for action – creating a static class
Methods redux
Overloading methods
Time for action – overloading the level restart
Ref parameters
Time for action – tracking player restarts
Out parameters
OOP redux
Interfaces
Time for action – creating a manager interface
Time for action – adopting an interface
Abstract classes
Class extensions
Time for action – extending the string class
Time for action – using an extension method
Namespace redux
Type aliasing
Summary
Pop quiz – leveling up
Chapter 11: Introducing Stacks, Queues, and HashSets
Introducing stacks
Basic syntax
Time for action – storing collected items
Popping and peeking
Time for action – the last item collected
Common methods
Working with queues
Basic syntax
Adding, removing, and peeking
Common methods
Using HashSets
Basic syntax
Performing operations
Summary
Pop quiz – intermediate collections
Chapter 12: Exploring Generics, Delegates, and Beyond
Introducing generics
Generic objects
Time for action – creating a generic collection
Generic methods
Time for action – adding a generic item
Constraining type parameters
Time for action – limiting generic elements
Delegating actions
Basic syntax
Time for action – creating a debug delegate
Delegates as parameter types
Time for action – using a delegate argument
Firing events
Basic syntax
Time for action – creating an event
Handling event subscriptions
Time for action – subscribing to an event
Handling exceptions
Throwing exceptions
Time for action – checking negative scene indexes
Using try-catch
Time for action – catching restart errors
Design pattern primer
Common game patterns
Summary
Pop quiz – intermediate C#
Chapter 13: The Journey Continues
Scratching the surface
Remembering your object-oriented programming
Approaching Unity projects
Unity features we didn't cover
Next steps
C# resources
Unity resources
Unity certifications
Hero's trial – putting something out into the world
Summary
Pop Quiz Answers
Other Books You May Enjoy
Index


📜 SIMILAR VOLUMES


Learning C# by Developing Games with Uni
✍ Harrison Ferrone 📂 Library 📅 2021 🏛 Packt Publishing - ebooks Account 🌐 English

<p><b>Learn C# programming from scratch using Unity as a fun and accessible entry point with this updated edition of the bestselling series</b></p><h4>Key Features</h4><ul><li>Learn C# programming basics, terminology, and coding best practices</li><li>Become confident with Unity fundamentals and fea