万本电子书0元读

万本电子书0元读

顶部广告

Learning C# by Developing Games with Unity 2019电子书

售       价:¥

17人正在读 | 0人评论 9.8

作       者:Harrison Ferrone

出  版  社:Packt Publishing

出版时间:2019-03-30

字       数:32.4万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Understand the fundamentals of C# programming and get started with coding from ground up in an engaging and practical manner Key Features * Beginner's guide to getting started with software development concepts from a macro level * Leverage the power of the latest C# in solving the complex programming problems * Learn to script and customize your 3D games and implement animation techniques to make them engaging Book Description Learning to program in today’s technical landscape can be a daunting task, especially when faced with the sheer number of languages you have to choose from. Luckily, Learning C# with Unity 2019 removes the guesswork and starts you off on the path to becoming a confident, and competent, programmer using game development with Unity. You’ll start off small by learning the building blocks of programming, from variables, methods, and conditional statements to classes and object-oriented systems. After you have the basics under your belt you’ll explore the Unity interface, creating C# scripts, and translating your newfound knowledge into simple game mechanics. Throughout this journey, you’ll get hands-on experience with programming best practices and macro-level topics such as manager classes and flexible application architecture. By the end of the book, you’ll be familiar with intermediate C# topics like generics, delegates, and events, setting you up to take on projects of your own. What you will learn * Understand programming fundamentals with practice examples in C# * Explore the interface and features of Unity 2019 * Learn C# programming syntax from scratch * Create a game design document and prototype level * Explore intermediate programming topics and best practices * Implement game mechanics, interactions, and UI elements with C# Who this book is for The book caters to developers and programmers who want to get started with C# programming in a fun and engaging manner. Anyone who wants to build games and script in C# language and Unity can take this book up. No prior programming or Unity experience is required.
目录展开

Dedication

About Packt

Why subscribe?

Packt.com

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Downloading the Example Code Files

Downloading the Color Images

Conventions Used

Sections

Time for Action

What just happened?

Pop Quiz – Heading

Hero's Trial – Heading

Get in Touch

Reviews

Section 1: Programming Foundations and C#

Getting to Know your Environment

Some basic prerequisites

Starting out with Unity 2019

Creating a new project

Navigating the editor

Using C# with Unity

Working with C# scripts

Time for action – creating a C# script

Introducing the Visual Studio editor

Time for action – opening a C# file

Beware of naming mismatches

Syncing C# files

Fixing a broken sync

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

Pop quiz – dealing with scripts

Summary

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

A method to the madness

Methods drive actions

Methods are placeholders too

Time for action – a simple method

Introducing classes

A class all along

Everyday blueprints

Commenting is key

Practical backslashes

Time for action – adding comments

Putting it together in Unity

Scripts become components

Variables and the Inspector panel

A helping hand from MonoBehavior

Hero's trial – MonoBehavior in the Scripting API

Class and component communication

Enter dot notation

Pop quiz – C# building blocks

Summary

Diving into Variables,Types, and Methods

Writing proper C#

Simple debugging

Variable syntax

Type and value declarations

Type-only declarations

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

Variable scope

Introducing operators

Arithmetic and assignments

Time for action – executing incorrect type operations

Pop quiz #1 – variables and types

Defining methods

Basic syntax

Modifiers and parameters

Time for action – defining a simple method

Naming conventions

Methods are logic detours

Specifying parameters

Assigning arguments

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

Common Unity methods

The Start method

The Update method

Pop quiz #2 – Understanding methods

Summary

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

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

What's a struct?

Basic syntax

Time for action – creating a weapon struct

Classes vs structs

Reference types

Time for action – creating a new hero

Value types

Time for action – copying weapons

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

Finding GameObjects

Time for action - finding components on different objects

Drag and drop

Time for action – assigning variables in Unity

Pop quiz: all things OOP

Summary

Section 2: Scripting Game Mechanics in Unity

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

Pop quiz – basic Unity features

Summary

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

Camera follow

Time for action – Scripting camera behavior

Working with Unity physics

Rigidbodies in motion

Time for action – accessing the Rigidbody

Time for action – moving the Rigidbody

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

Pop quiz – player controls and physics

Summary

Scripting Game Mechanics

Adding jumps

Enter 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

The 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

Player Polish

Graphical User Interfaces

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

Pop quiz – working with mechanics

Summary

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

Pop quiz – AI and navigation

Summary

Section 3: Leveling Up Your C# Code

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

Pop quiz – leveling up

Summary

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 a try-catch

Time for action – catching restart errors

Design pattern primer

Common game patterns

Pop quiz – intermediate C#

Summary

The Journey Continues

Scratching the surface

Putting the pieces together

Remembering your OOP

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

Completed Game Files

Bullet behavior

Camera behavior

Enemy behavior

Game behavior

Item behavior

Player behavior

Supplementary Classes

Custom extensions

IManager

Inventory list

Utilities

Pop Quiz Answers

Chapter 1 – Getting to Know Your Environment

Pop quiz – dealing with scripts

Chapter 2 – Introducing the Building Blocks of Programming

Pop quiz – C# building blocks

Chapter 3 – Diving into Variables, Types, and Methods

Pop quiz #1 – variables and types

Pop quiz #2 – understanding methods

Chapter 4 – Using Collections and Controlling Your Code

Pop quiz #1 – If, and, or but

Pop quiz #2 – all about collections

Chapter 5 – Working with Classes, Structs, and OOP

Pop quiz – all things OOP

Chapter 6 – Getting Your Hands Dirty with Unity

Pop quiz – basic Unity features

Chapter 7 – Movement, Camera Controls, and Collisions

Pop quiz – player controls and physics

Chapter 8 – Scripting Game Mechanics

Pop quiz – working with mechanics

Chapter 9 – Basic AI and Enemy Behavior

Pop quiz – AI and navigation

Chapter 10 – Revisiting Types, Methods, and Classes

Pop quiz – leveling up

Chapter 11 – Exploring Generics, Delegates, and Beyond

Pop quiz – intermediate C#

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部