*
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
[RequireComponent(typeof(Inventory))]
|
||||
public class InventoryPack : MonoBehaviour {
|
||||
|
||||
public GameObject[] items;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
var inventory = GetComponent<Inventory>();
|
||||
|
||||
if (items != null && items.Length > 0) {
|
||||
foreach (var item in items) {
|
||||
var pickable = item.GetComponent<PickableItem>();
|
||||
if (pickable != null) {
|
||||
var clone = Instantiate(item);
|
||||
var pi = clone.GetComponent<PickableItem>();
|
||||
if (pi.sensor != null) {
|
||||
pi.sensor.enabled = false;
|
||||
pi.sensor.sensorEnabled = false;
|
||||
}
|
||||
inventory.AddItem(pi);
|
||||
Debug.Log("InventoryPack add item: " + clone.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user