Last updated: Sep 8, 2022

Introduction

The Inventory Behaviour abstract class exists with the sole purpose of acting as a base class for the Inventory script. It defines what an Inventory class needs and allows us to override its functions with whatever we want, in our case we do this in that aforementioned Inventory class.

You can find the Inventory Behaviour script ****at this path: Assets\Infima Games\Low Poly Animated - Modern Guns\Demo\Code\Inventory\InventoryBehaviour.cs

Methods

Init. This function is called when the game starts. We don't use Awake or Start because we need the PlayerCharacter component to run this with the index it wants to equip!

Equip. Equips an item.

Functions

Get Last Index. Returns the index that is before the current index. Very helpful in order to figure out what the next weapon to equip is.

Get Next Index. Returns the next index after the currently equipped one. Very helpful in order to figure out what the next weapon to equip is.

Get Equipped. Returns the currently equipped WeaponBehaviour.

Get Equipped Index. Returns the currently equipped index. Meaning the index in the weapon array of the equipped weapon.