PlayerController Mods
Code modifications that must be manually included into PlayerController in order for the Inventory System logic to be included in the MiniGame logic.
The Video below shows configurations that are required for integrating the Inventory System with the MiniGame.
IMPORTANT - You may need to download updated Inventory System Files: If you have InventoryDisplay behavior as shown at the end of this video where each diamond occupies a separate inventory slot - then download and install this package with updated Inventory System Files: You may need to re-attach InventoryDisplay.cs to the InventoryDisplay Prefab
Code Updated Apr 13, 2019
Updated Code Inventory System Code Files - Due to a change in the way the scriptableObjects are attached to the PickUp prefabs, the Inventory System files were changed so that the InventoryDisplay's Dictionary has been changed from Dictionary< ItemInstance, int> , where prior versions were able to recognize that Scriptable Object ItemInstances of the same type: IE: Gem.Sapphire were all identical, meaning they had the same memory-address. To fix this issue, a new field had to be added to the Item class: public string instanceType, where this must be set in the constructor for the child classes.
Updated code for PlayerController
Note: There will be additional modifications, not included here, which include UnityEvents used in LevelManager and Collisions with Water, Exit, and AudioClips
Modified Content: in onTriggerEnter( )
Added:
GameData.InstanceRef.AddItem( item.itemInstance ), so that we add the item to the GameData inventory.Modified: Code when gameObject has tag 'Hazard', to incorporate logic for gameObjects with Hazard Component (has no ItemInstance ) instead of using the PickUp Component on Hazard Items.
Code - PlayerController.cs - For Inventory System
Updated Apr 13, 2019
Last updated
Was this helpful?