PickUp, Hazard, ScorePickUp

Updated PickUp.cs and Hazard.cs were included in the InventorySystem Package.

updated Apr 10,2019

//Included with InventorySystem Scripts

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

//combines frontEnd UI and BackEnd 
public class PickUp : MonoBehaviour {

    public ItemInstance itemInstance;

    private int value;

    //read-only property
    public int Value
    {
        get { return value; }
    }

    private void Start()
    {
        this.value = itemInstance.item.value;
    }

    /// <summary>
    /// Adds the item to GameData Inventory
    /// Can be executed by button.onClick
    /// when added as a listener
    /// </summary>
    public void AddItem( ) //can be called onClick for a button
    {
        GameData.instanceRef.AddItem(this.itemInstance);
    }
}//end class PickUp

Hazard Class

This simple class will be used to replace PickUp for Hazard-type objects.

Included with InventorySystem Scripts

ScorePickUp

This simple class can be used to replace PickUp.cs script component for objects with Collectible Tag, if the item only impacts the score, with no inventory items added.

Last updated

Was this helpful?