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
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Item count modifications


Now that we have discussed the features of the inventory, we need to figure out how items in the inventory can be gained or lost. This can be done in the following ways:

  • Buying, selling, and trading items

  • Dropping and picking up items

  • Destroying or using items

Item bartering

If your game has a lot of items in its world, you might have included shops within that world. In these shops, the player can sell their items or buy more items. This method is very common in role-playing games, as these types of games have many items. Another way to barter items is to trade them. This can be done in offline games, but this is mostly seen in online games where players can use a menu system to trade their items.

Dropping and picking up items

When the player's inventory is full or almost full, they might come across an item that they want. If the option is made available, the player can drop an item they don't want anymore and pick up the new item to replace it. Dropping an item can insert...