Next: , Previous: , Up: Inventory   [Contents][Index]


10.5 Clip Inventory

Component: ClipInventory

This component is an inventory that goes on the Player object and is required for the use of ’ModernGun’ objects. To use, simply decide how many ammo types you would like. Then, input that as the ’Size’ for both Num Clips and Max Clips. Finally set a maximum and initial value for each. So, if machine gun bullets are the first ammo type, then NumClips[0] represents the number of machine gun clips we currently have, and MaxClips[0] represents the maximum number of machine gun clips we can have. A clip is an object that contains many bullets. So this gives a ’realistic’ reloading system where partial clips are discarded (clips are tracked instead of individual rounds).

Field of ClipInventory: int[] numClips

Number of currently held clips for a given clip type index

Field of ClipInventory: int[] maxClips

Maximum number of clips for a given clip type index

GUI Settings

Field of ClipInventory: bool useGUI

Should we show a legacy Unity GUI for this information?

Default value: true

Field of ClipInventory: Rect guiArea

Normalized viewport rectangle for the GUI, values between 0 and 1

Default value: new Rect(0.2f,.8f, .1f, .19f)

Save & Load Settings

Field of ClipInventory: bool autoSave

Should we save this data in the Player Prefs file?

Default value: true

Field of ClipInventory: float autoSaveInterval

How often do we attempt to auto-save?

Default value: 30.0f

Available Messages

Message on ClipInventory: Save ()

Saves the current clip counts in Player Prefs

Message on ClipInventory: Load ()

Loads the clip counts from Player Prefs

Field of ClipInventory: int[] numClips

Number of currently held clips for a given clip type index

Field of ClipInventory: int[] maxClips

Maximum number of clips for a given clip type index

GUI Settings

Field of ClipInventory: bool useGUI

Should we show a legacy Unity GUI for this information?

Default value: true

Field of ClipInventory: Rect guiArea

Normalized viewport rectangle for the GUI, values between 0 and 1

Default value: new Rect(0.2f,.8f, .1f, .19f)

Save & Load Settings

Field of ClipInventory: bool autoSave

Should we save this data in the Player Prefs file?

Default value: true

Field of ClipInventory: float autoSaveInterval

How often do we attempt to auto-save?

Default value: 30.0f

Available Messages

Message on ClipInventory: Save ()

Saves the current clip counts in Player Prefs

Message on ClipInventory: Load ()

Loads the clip counts from Player Prefs


Next: , Previous: , Up: Inventory   [Contents][Index]