Exemple #1
0
    private void Start()
    {
        _WeaPonSlotList[0]._item = cDataBaseManager.GetInstance._ItemList[0];
        ItemImageChange(_WeaPonSlotList[0]);
        _NowWeaPon.SetWeaPon(_WeaPonSlotList[0]._item);

        AddItem(cDataBaseManager.GetInstance._ItemList[1]);
        AddItem(cDataBaseManager.GetInstance._ItemList[2]);
        AddItem(cDataBaseManager.GetInstance._ItemList[3]);
        AddItem(cDataBaseManager.GetInstance._ItemList[4]);
        AddItem(cDataBaseManager.GetInstance._ItemList[5]);
        AddItem(cDataBaseManager.GetInstance._ItemList[6]);
        AddItem(cDataBaseManager.GetInstance._ItemList[7]);
        AddItem(cDataBaseManager.GetInstance._ItemList[8]);
        AddItem(cDataBaseManager.GetInstance._ItemList[9]);

        _Shop = FindObjectOfType <cShopNPC>();
    }
Exemple #2
0
    protected override void Awake()
    {
        base.Awake();
        _EmptyItem = Resources.Load("Prefabs/Inventory/EmptyItem") as GameObject;
        _Inventory = transform.GetChild(0);
        _draggingItem = transform.GetChild(0).GetChild(1);
        _Panel = transform.GetChild(0).GetChild(2);
        _Inventory.gameObject.SetActive(_ActiveInventory);
        _Gold = transform.GetChild(0).GetChild(0).GetChild(0).GetComponent<Text>();
        _Audio = GetComponent<AudioSource>();
        _Clip = Resources.Load<AudioClip>("Sound/OpenInventory");
        _Audio.clip = _Clip;
        //아이템 슬롯 세팅
        for (int i = 0; i < 3; i++)
        {
      
            for (int j = 0; j < 5; j++)
            {
                Transform newSlot = Instantiate(_Slot);
              
                newSlot.name = "Slot" + (i + 1) + "." + (j + 1);
                newSlot.SetParent(_Inventory.GetChild(0).transform);
                newSlot.localPosition= new Vector3(X,Y,0);
                _InventorySlot.Add(newSlot.GetComponent<cInventorySlot>());
                newSlot.GetComponent<cInventorySlot>()._number = i * 5 + j;
                X += 140.0f;
                if (j == 4)
                    X = -278.0f;
            }
            Y -= 127.0f;
        }
        Y = 296.0f;
        X = -244.0f;
        //무기슬롯 세팅
        for(int i = 0; i < 2; ++i)
        {
            Transform WeaponSLot = Instantiate(_WeaPonSlot);
            WeaponSLot.name = "WeaPon" + i;
            WeaponSLot.SetParent(_Inventory.GetChild(0).transform);
            WeaponSLot.localPosition = new Vector3(X, Y, 0);
            _WeaPonSlotList.Add(WeaponSLot.GetComponent<cInventorySlot>());
            WeaponSLot.GetComponent<cInventorySlot>()._number = i + 1;
            X += 353.0f;
        }

        X = -100.0f;
        //방어구 슬롯세팅
        for (int i = 0; i < 2; ++i)
        {
            Transform ShildSlot = Instantiate(_ShildSlot);
            ShildSlot.name = "Shild" + i;
            ShildSlot.SetParent(_Inventory.GetChild(0).transform);
            ShildSlot.localPosition = new Vector3(X, Y, 0);
            _ShildSlotList.Add(ShildSlot.GetComponent<cInventorySlot>());
            ShildSlot.GetComponent<cInventorySlot>()._number = i + 1;
            X += 353.0f;
        }



        //옵저버패턴
        cGameManager.GetInstance._DeleGateGold += SetGold;

        _Shop = FindObjectOfType<cShopNPC>();
    }