Casey Hardman

Game Programming with Unity and C#

A Complete Beginner’s Guide

Casey Hardman
West Palm Beach, FL, USA
ISBN 978-1-4842-5655-8e-ISBN 978-1-4842-5656-5
© Casey Hardman 2020
Standard Apress
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, express or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza, New York, NY 10004. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
Introduction

Welcome to the start of your adventure into game programming with Unity. This book is designed to teach you how to program video games from the ground up, while still engaging you with plenty of hands-on experience. It’s not focused on completing ambitious projects, and it’s not about fancy graphics. We’re learning how to program and how to use the Unity engine. Once you have a solid understanding of these integral topics, you can expand your knowledge and make more and more complicated and impressive games.

All of the software we’ll be using is cross-platform. This book will mostly stick to Windows-based terminology and examples, but you can still follow through with other major operating systems, like Mac or Linux, with little or no extra trouble.

As for system requirements, any modern computer purchased within the last 6 years or so should have little difficulty running the software we’ll be working with. Since we aren’t fiddling with high-end graphics or computing long-winded algorithms, the example projects we develop should run fine on most systems. If you have concerns, the official and most up-to-date system requirements for Unity can be found at the official website here:

https://unity3d.com/unity/system-requirements

In Chapters 112, we’ll begin with a primer for the essential concepts of the Unity game engine itself and get all our tools set up and ready for action. Then, we’ll get into the nitty-gritty details of programming, and we’ll start to actually write code ourselves.

In the remainder of the book, we’ll tackle individual game projects one at a time, making playable projects that you can add to later if you please. This is where you’ll get much of your hands-on experience. We’ll implement actual game mechanics, which is what you’re really after as a game programmer, right?

Game Project 1, “Obstacle Course” (Chapters 1325), will be a top-down obstacle course where the player moves their character with WASD or the arrow keys to avoid touching hazards of various forms: patrolling and wandering hazards, traveling projectiles, and spike traps in the floor. We’ll get practice with basic movement and rotation, setting up levels, working with fundamental Unity concepts like prefabs and scripting, and setting up UI.

Game Project 2, “Tower Defense” (Chapters 2632), will be the basis of a simple "tower defense" game, where the player places defensive structures on the playing field. Enemies will navigate from one side of the field to the other, and the player’s defenses will attempt to fend them off. We’ll explore basic pathfinding (how the enemies navigate around arbitrary obstacles) and further expand on fundamental programming concepts.

Game Project 3, “Physics Playground” (Chapters 3341), will be a 3D physics playground with first- and third-person camera support for a player character with more intricate mouse-aimed movement, jumping, wall jumping, and gravity systems. We’ll explore the possibilities of Unity physics, from detecting objects with raycasts to setting up joints and Rigidbodies.

Table of Contents
Part I: Obstacle Course139
Part III: Physics Playground447
Index 565
About the Author and About the Technical Reviewer
About the Author
Casey Hardman
../images/486227_1_En_BookFrontmatter_Figb_HTML.jpg

is a hobbyist game developer, who found inspiration in the capacity for immersion and interactivity provided by games. His area of focus is the Unity game engine. He has nurtured a passion for video games since he was a child. In his early teens, this interest led him on a journey into the world of game design and programming. He is self-taught through a variety of personal projects, some small and some lofty. He has been a regular contributor on various online game development platforms and spends far too much time in front of the computer.

 
About the Technical Reviewer
Robert Lair
../images/486227_1_En_BookFrontmatter_Figc_HTML.jpg

has been building software professionally for more than 25 years and has served at just about every position in the SDLC. He has served as President/CEO, VP of Product Development, CTO, Software Architect, Developer, and Scrum Master/Product Manager. He believes that building good software is an art and is passionate about correctly architected software, efficient development processes, documentation, reducing technical debt, organization, and productivity. He specializes in building Unity, web, and mobile applications focused on gamification. You can find out more about Robert at his website, www.robertlair.com .

 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.187.24