Book Image

Unity Game Development Scripting

By : Kyle D'Aoust
Book Image

Unity Game Development Scripting

By: Kyle D'Aoust

Overview of this book

Table of Contents (17 chapters)
Unity Game Development Scripting
About the Author
About the Reviewers

Chapter 3. Expandable Item Classes

Items in video games are very important. They can be tools, weapons, healing items, traps, clothing, armor, ammo, keys, and so on. Items are what the player will interact with the most in your game. Since the items are so often used, it is a good practice to create item classes that can be expanded and used in all possible situations without having to rewrite the class.

In this chapter, we will cover the following topics:

  • Creating customizable classes for items

  • Learning how GameObjects can interact with each other through sending messages

  • Creating an Item class that affects the player

  • Creating a Melee item class that will affect environments and enemies

  • Creating a Projectile item class that can be used for items that travel distances

  • Utilizing a classification system for all objects to decide what they do

  • Using trigger-based collisions for the Melee and Projectile item classes

  • Using two types of movement for projectile items