Пример #1
0
    void Start()
    {
        IsEquipSlot[] equipSlots = GetComponentsInChildren <IsEquipSlot>();
        for (int i = 0; i < equipSlots.Length; i++)
        {
            if (equipSlots[i].slotType == IsEquipSlot.eSlotType.rightHand)
            {
                weaponSlot = equipSlots[i];
                break;
            }
        }

        // wake all InventoryViews
        IsInventoryView[] inventoryViews = FindObjectsOfType <IsInventoryView>();
        foreach (IsInventoryView iV in inventoryViews)
        {
            iV.gameObject.SetActive(true);
            iV.enabled = true;
        }
    }
Пример #2
0
    public void AttachToSlot(GameObject newParent)
    {
        // find appropriate equipment slot and attach to it
        IsEquipSlot[] equipSlots = newParent.GetComponentsInChildren <IsEquipSlot>();

        for (int i = 0; i < equipSlots.Length; i++)
        {
            if (equipSlots[i].slotType == this.slotType)
            {
                this.transform.SetParent(equipSlots[i].transform);
                this.transform.localPosition = Vector3.zero;
                this.transform.localRotation = Quaternion.identity;
                equipSlot = equipSlots[i];
                equipSlot.AddEquipment(this);

                if (autoEquip)
                {
                    equipSlot.TryEquip(this);
                }

                break;
            }
        }
    }