Skip to content

Instantly share code, notes, and snippets.

@dimmduh
Created October 27, 2015 04:59
Show Gist options
  • Save dimmduh/01dcb209b9a26e7042f5 to your computer and use it in GitHub Desktop.
Save dimmduh/01dcb209b9a26e7042f5 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Devdog.InventorySystem;
//Связывает скилбар с фпс префабом
//если в скиллбар помещается оружие, то говорит фпс префабу, добавить оружие
public class UISkillbarToFPSPrefab : MonoBehaviour {
//тебе это нужно??
private Devdog.InventorySystem.SkillbarUI skillbar;
public void Awake()
{
//GetComponentInParent<InventoryPlayer>().;
skillbar = InventoryPlayerManager.instance.currentPlayer.skillbarCollection;
// Register the hide event
skillbar.OnAddedItem += (item, amount, cameFromCollection) =>
{
OnAddedItem(item, amount, cameFromCollection);
};
}
private void OnAddedItem(IEnumerable<InventoryItemBase> items, uint amount, bool cameFromCollection)
{
//похоже только дин элемент всегда?
foreach (InventoryItemBase item in items)
{
if (item.category.name.Equals("Weapon"))
{
item.gameObject.GetComponent<WeaponPickup>().PickUpItem();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment