Created
October 27, 2015 04:59
-
-
Save dimmduh/01dcb209b9a26e7042f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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