Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Unity 2021 Game Development

You're reading from   Hands-On Unity 2021 Game Development Create, customize, and optimize your own professional games from scratch with Unity 2021

Arrow left icon
Product type Paperback
Published in Aug 2021
Publisher Packt
ISBN-13 9781801071482
Length 710 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Nicolas Alejandro Borromeo Nicolas Alejandro Borromeo
Author Profile Icon Nicolas Alejandro Borromeo
Nicolas Alejandro Borromeo
Arrow right icon
View More author details
Toc

Table of Contents (29) Chapters Close

Preface 1. Section 1 – Our First Level
2. Chapter 1: Designing a Game from Scratch FREE CHAPTER 3. Chapter 2: Setting Up Unity 4. Chapter 3: Working with Scenes and Game Objects 5. Chapter 4: Grayboxing with Terrain and ProBuilder 6. Chapter 5: Importing and Integrating Assets 7. Section 2 – Improving Graphics and Sound
8. Chapter 6: Materials and Effects with URP and Shader Graph 9. Chapter 7: Visual Effects with Particle Systems and Visual Effect Graph 10. Chapter 8: Lighting Using the Universal Render Pipeline 11. Chapter 9: Fullscreen Effects with Postprocessing 12. Chapter 10: Sound and Music Integration 13. Chapter 11: User Interface Design 14. Chapter 12: Creating a UI with the UI Toolkit 15. Chapter 13: Creating Animations with Animator, Cinemachine, and Timeline 16. Section 3 – Scripting Level Interactivity with C#
17. Chapter 14: Introduction to C# and Visual Scripting 18. Chapter 15: Implementing Movement and Spawning 19. Chapter 16: Physics Collisions and Health System 20. Chapter 17: Win and Lose Condition 21. Chapter 18: Scripting the UI, Sounds, and Graphics 22. Chapter 19: Implementing Game AI for Building Enemies 23. Chapter 20: Scene Performance Optimization 24. Section 4 – Releasing Your Game
25. Chapter 21: Building the Project 26. Chapter 22: Finishing Touches 27. Chapter 23: Augmented Reality in Unity 28. Other Books You May Enjoy

Game characters

Our game will feature several objects, but only two game characters. The first game character is our Hero and will be controlled by the player. The second type of game character is the Enemies. They are non-player characters that are controlled by AI. Let's look more closely at both of these characters.

Hero

The player will play our game as the Hero, our game's protagonist. So, what can our Hero player character do? We already know we will be able to move them throughout our game environment using a combination of keyboard and mouse inputs. We also know that the left mouse button—our action button—will cause them to shoot bullets.

Important note

Because the Hero is controlled by a human player, it is referred to as the Player Character.

We will implement the following animations for the Hero:

  • Idle: This animation will play when the character is not being moved by the player.
  • Run: This animation will play when the character is being moved by the player.
  • Shoot: This is an animation that will cause the Hero to shoot a bullet.

That's our player. Now, let's discuss our enemy character.

Enemies

Our game's antagonists will be Enemy Soldiers. We will control how many of them we want in our game and where they are placed. We will also control their behavior through AI. The Enemies will go straight to the base and, once there, they will start damaging it. We will determine how long it takes for our base to be completely destroyed. If during their journey to the base, the enemy encounters the player, they will prioritize shooting at them.

Important note:

Because the Enemy is controlled by AI and not a human player, it is referred to as a Non-Player Character (NPC).

The soldiers will share the following two animations, which the Player Character also uses, but they will be executed in different scenarios:

  • Run: This animation will play when the Enemy's AI is moving the enemy toward the base.
  • Shoot: This is an animation that will be played when the AI decides to shoot at the Player's Base or the Player's Character.

Careful planning and scripting will be required to create the desired Enemy behaviors; this will include decisions regarding the number and placement of the Enemies, and we will be tackling this during the designing phase and also during the development.

Now that we have defined our characters, let's discuss how the game will be played, looking at the specific details.

You have been reading a chapter from
Hands-On Unity 2021 Game Development - Second Edition
Published in: Aug 2021
Publisher: Packt
ISBN-13: 9781801071482
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime