//드래그 끝날때 끝나는 슬롯이 뭐냐에 따라 효과다름 public void OnEndDrag(PointerEventData eventData) { //아까 옮긴 아이템을 다시 자기자식으로 옮김 cInventory.GetInstance._DraggingItem.GetChild(0).SetParent(transform); transform.GetChild(0).localPosition = Vector3.zero; if (cInventory.GetInstance._EnteredSlot != null) { //레이캐스트 타겟을 켬 transform.GetChild(0).GetComponent <Image>().raycastTarget = true; //이동하는 슬롯이 무기슬롯이고 첫번째 무기슬롯일때 무기변경하고 현제 장착중인 무기도 변경 if (cInventory.GetInstance._EnteredSlot._SlotType == SlotType.Weapon && cInventory.GetInstance._EnteredSlot == cInventory.GetInstance.GetWeaponSlot(0)) { ChangeItem(); _Weapon.SetWeaPon(cInventory.GetInstance._EnteredSlot._item); cUIManager.GetInstance.GetWeaPonSlot().SetItem(); cUIManager.GetInstance.GetSkill().SetImage(cInventory.GetInstance._EnteredSlot._item); } //1번 무기 슬롯에있는걸 2번무기슬롯이 비어있을때 이동안됨 else if (this == cInventory.GetInstance.GetWeaponSlot(0) && cInventory.GetInstance._EnteredSlot == cInventory.GetInstance.GetWeaponSlot(1) && cInventory.GetInstance.GetWeaponSlot(1)._item._ItemIcon == null) { return; } // 1번무기슬롯에 있는 아이템 못뺌 else if (this == cInventory.GetInstance.GetWeaponSlot(0) && cInventory.GetInstance._EnteredSlot._SlotType == SlotType.Basic && cInventory.GetInstance._EnteredSlot._item._ItemIcon == null) { return; } //2번무기 슬롯아이템 집어넣고 UI상에 보이게함 else if (cInventory.GetInstance._EnteredSlot._SlotType == SlotType.Weapon && cInventory.GetInstance._EnteredSlot == cInventory.GetInstance.GetWeaponSlot(1)) { ChangeItem(); cUIManager.GetInstance.GetWeaPonSlot().SetItem(); } //일반 슬롯에 아이템이 있으면 무기변경 else if (cInventory.GetInstance._EnteredSlot._SlotType == SlotType.Basic && this == cInventory.GetInstance.GetWeaponSlot(0)) { ChangeItem(); _Weapon.SetWeaPon(this._item); cUIManager.GetInstance.GetWeaPonSlot().SetItem(); } //일반 슬롯 끼리는 아이템 위치변경 else if (cInventory.GetInstance._EnteredSlot._SlotType == SlotType.Basic) { ChangeItem(); } } }
private void Update() { //탭누를시 무기 1번 슬롯 2번슬롯 변경 if (Input.GetKeyDown(KeyCode.Tab)) { if (cInventory.GetInstance.GetWeaponSlot(1)._item._ItemIcon != null) { cInventory.GetInstance.ChangeWeapon(); cUIManager.GetInstance.GetSkill().SetImage(cInventory.GetInstance.GetWeaponSlot(0)._item); cUIManager.GetInstance.GetWeaPonSlot().ChangeSlot(); _WeaPon.SetWeaPon(cInventory.GetInstance.GetWeaponSlot(0)._item); } } if (Input.GetKeyDown(KeyCode.T)) { if (_Stat.gameObject.activeSelf == false) { _Stat.gameObject.SetActive(true); } else if (_Stat.gameObject.activeSelf == true) { _Stat.gameObject.SetActive(false); } } //인벤토리 열기 if (Input.GetKeyDown(KeyCode.I)) { cInventory.GetInstance.SetActive(); } //ESC누를시 일시정지 if (Input.GetKeyDown(KeyCode.Escape)) { SetStop(); } //클릭시마우스버튼변경 if (Input.GetMouseButton(0)) { Cursor.SetCursor(_ClickTexture, Vector2.zero, _CursorMode); } else if (Input.GetMouseButtonUp(0)) { Cursor.SetCursor(_CursorTexture, Vector2.zero, _CursorMode); } //플레이어 죽으면 할것 if (Player.GetInstance._state == State.Die) { if (!_isDie) { _BackGround.Stop(); _BackGround.loop = false; _BackGround.clip = _BackGroundClip[4]; _BackGround.Play(); Player.GetInstance._Ani.SetTrigger("DIe"); _Dead.SetActive(true); _isDie = true; } } }
private void Start() { _WeaPonSlotList[0]._item = cDataBaseManager.GetInstance._ItemList[0]; ItemImageChange(_WeaPonSlotList[0]); _NowWeaPon.SetWeaPon(_WeaPonSlotList[0]._item); }
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>(); }
private void Update() { //탭누를시 무기 1번 슬롯 2번슬롯 변경 if (Input.GetKeyDown(KeyCode.Tab)) { if (_WeaponNum == 0) { _WeaponNum = 1; } else if (_WeaponNum == 1) { _WeaponNum = 0; } cUIManager.GetInstance.GetWeaPonSlot().ChangeSlot(); _WeaPon.SetWeaPon(cInventory.GetInstance.GetWeaponSlot(_WeaponNum)._item); } //인벤토리 열기 if (Input.GetKeyDown(KeyCode.I)) { cInventory.GetInstance.SetActive(); } //ESC누를시 일시정지 if (Input.GetKeyDown(KeyCode.Escape)) { _StopPanel.SetActive(true); Time.timeScale = 0; } if (Input.GetMouseButtonDown(0)) { Cursor.SetCursor(_ClickTexture, Vector2.zero, _CursorMode); } else if (Input.GetMouseButtonUp(0)) { Cursor.SetCursor(_CursorTexture, Vector2.zero, _CursorMode); } if (Player.GetInstance._state == State.Die) { _BackGround.Stop(); _BackGround.loop = false; Player.GetInstance.transform.rotation = Quaternion.Euler(0, 0, 90); // 죽는소리재생 } }