static public List <InvenSlot> GetInvenSlots(Items.ITEM_TYPE type) { List <InvenSlot> temp = new List <InvenSlot>(); for (int y = 0; y < Slots.Count; y++) { for (int x = 0; x < Slots[y].Count; x++) { if (!Slots[y][x].Item) { continue; } if (Slots[y][x].Item.Type != type) { continue; } temp.Add(Slots[y][x]); } } if (temp.Count == 0) { temp = null; } return(temp); }
public Dictionary <int, List <Items> > GetItems(Items.ITEM_TYPE type) { Dictionary <int, List <Items> > dTemp = new Dictionary <int, List <Items> >(); foreach (var key in mItemPool[type]) { foreach (var sKey in key.Value) { List <Items> lTemp = null; for (int i = 0; i < sKey.Value.Count; i++) { if (sKey.Value[i].IsUse) { continue; } Items temp = sKey.Value[i]; temp.IsUse = true; if (dTemp.TryGetValue(key.Key, out lTemp)) { lTemp.Add(temp); break; } else { lTemp = new List <Items>(); dTemp.Add(key.Key, lTemp); lTemp.Add(temp); break; } } } } return(dTemp); }
public Items GetRandomItem() { Items item = null; while (!item) { int min = (int)(Items.ITEM_TYPE.BASEMATERIAL); int max = (int)(Items.ITEM_TYPE.TOOL) + 1; Items.ITEM_TYPE type = (Items.ITEM_TYPE)(Random.Range(min, max)); item = GetRandomItem(type); } return(item); }
public List <Items> GetTierItems(Items.ITEM_TYPE type, int tier) { List <Items> temp = new List <Items>(); Dictionary <string, List <Items> > tDic = null; if (!mItemPool[type].ContainsKey(tier)) { Debug.Log("해당 티어의 아이템이 없습니다."); return(null); } foreach (KeyValuePair <string, List <Items> > item in tDic) { // 중복 체크 bool isExist = false; for (int i = 0; i < temp.Count; i++) { if (temp[i].ItemName == item.Key) { isExist = true; break; } } if (isExist) { continue; } List <Items> tList = item.Value; for (int i = 0; i < tList.Count; i++) { if (tList[i].IsUse) { continue; } tList[i].IsUse = true; temp.Add(tList[i]); break; } } return(temp); }
static public Items GetInvenItem(Items.ITEM_TYPE type) { Items temp = null; for (int y = 0; y < Slots.Count; y++) { for (int x = 0; x < Slots[x].Count; x++) { if (!Slots[y][x].Item) { continue; } if (Slots[y][x].Item.Type != type) { continue; } return(temp = GameManager.Instance.ObjPool.GetItem(Slots[y][x].Item.ItemName)); } } return(temp); }
// Use this for initialization void Start () { typeSelected = Items.ITEM_TYPE.Armor_Head; textUI = uiItemType.GetComponent<Text> (); uiItemNameText = uiItemName.GetComponent<Text> (); playerScript = gameObject.GetComponent<Player> (); }
void goToNextItemType() { switch(typeSelected) { case Items.ITEM_TYPE.Armor_Boots: typeSelected = Items.ITEM_TYPE.Armor_Head; playerScript.stableCam.transform.position = playerScript.inventoryHeadCam.position; playerScript.stableCam.transform.rotation = playerScript.inventoryHeadCam.rotation; playerScript.model.GetComponent<Animation>().wrapMode = WrapMode.Loop; playerScript.model.GetComponent<Animation>().Play (playerScript.idleAnimation); break; case Items.ITEM_TYPE.Armor_Head: typeSelected = Items.ITEM_TYPE.Armor_Legs; playerScript.stableCam.transform.position = playerScript.inventoryBootsCam.position; playerScript.stableCam.transform.rotation = playerScript.inventoryBootsCam.rotation; playerScript.model.GetComponent<Animation>().wrapMode = WrapMode.Loop; playerScript.model.GetComponent<Animation>().Play (playerScript.idleAnimation); break; case Items.ITEM_TYPE.Armor_Legs: typeSelected = Items.ITEM_TYPE.Armor_Shoulder; playerScript.stableCam.transform.position = playerScript.inventoryHeadCam.position; playerScript.stableCam.transform.rotation = playerScript.inventoryHeadCam.rotation; playerScript.model.GetComponent<Animation>().wrapMode = WrapMode.Loop; playerScript.model.GetComponent<Animation>().Play (playerScript.idleAnimation); break; case Items.ITEM_TYPE.Armor_Shoulder: typeSelected = Items.ITEM_TYPE.Armor_Torso; playerScript.stableCam.transform.position = playerScript.inventoryHeadCam.position; playerScript.stableCam.transform.rotation = playerScript.inventoryHeadCam.rotation; playerScript.model.GetComponent<Animation>().wrapMode = WrapMode.Loop; playerScript.model.GetComponent<Animation>().Play (playerScript.idleAnimation); break; case Items.ITEM_TYPE.Armor_Torso: typeSelected = Items.ITEM_TYPE.Bow; playerScript.stableCam.transform.position = playerScript.inventoryCamPos.position; playerScript.stableCam.transform.rotation = playerScript.inventoryCamPos.rotation; playerScript.model.GetComponent<Animation>().wrapMode = WrapMode.Loop; playerScript.model.GetComponent<Animation>().Play ("BowCharge_Shoot"); break; case Items.ITEM_TYPE.Bow: typeSelected = Items.ITEM_TYPE.Shield; playerScript.stableCam.transform.position = playerScript.inventoryCamPos.position; playerScript.stableCam.transform.rotation = playerScript.inventoryCamPos.rotation; playerScript.model.GetComponent<Animation>().wrapMode = WrapMode.Loop; if (UnityEngine.Random.Range(0,2) == 0) playerScript.model.GetComponent<Animation>().Play (playerScript.shieldBlockReadyAnimation); else playerScript.model.GetComponent<Animation>().Play ("SwordShieldBanging_shield"); break; case Items.ITEM_TYPE.Shield: typeSelected = Items.ITEM_TYPE.Weapon_2H; playerScript.stableCam.transform.position = playerScript.inventoryCamPos.position; playerScript.stableCam.transform.rotation = playerScript.inventoryCamPos.rotation; playerScript.model.GetComponent<Animation>().wrapMode = WrapMode.Loop; playerScript.model.GetComponent<Animation>().Play (playerScript.mainAttackAnimation); break; case Items.ITEM_TYPE.Weapon_2H: typeSelected = Items.ITEM_TYPE.Weapon_RH; playerScript.stableCam.transform.position = playerScript.inventoryCamPos.position; playerScript.stableCam.transform.rotation = playerScript.inventoryCamPos.rotation; playerScript.model.GetComponent<Animation>().wrapMode = WrapMode.Loop; playerScript.model.GetComponent<Animation>().Play (playerScript.mainAttackAnimation); break; case Items.ITEM_TYPE.Weapon_RH: typeSelected = Items.ITEM_TYPE.Armor_Boots; playerScript.stableCam.transform.position = playerScript.inventoryBootsCam.position; playerScript.stableCam.transform.rotation = playerScript.inventoryBootsCam.rotation; playerScript.model.GetComponent<Animation>().wrapMode = WrapMode.Loop; playerScript.model.GetComponent<Animation>().Play (playerScript.idleAnimation); break; } textUI.text = typeSelected.ToString(); }
public Items GetRandomItem(Items.ITEM_TYPE type) { Items items = null; while (!items) { int max = 0; int rNum = 0; switch (type) { case Items.ITEM_TYPE.BASEMATERIAL: max = Mathf.CeilToInt(Player.ShopLv / 5f) > 2 ? 2 : Mathf.CeilToInt(Player.ShopLv / 5f); break; case Items.ITEM_TYPE.MATERIAL: rNum = Random.Range(0, 3); switch (rNum) { default: case 0: max = Player.ForgeLv; break; case 1: max = Player.AlchmicLv; break; case 2: max = Player.SewingLv; break; } break; case Items.ITEM_TYPE.WEAPON: max = Player.ForgeLv; break; case Items.ITEM_TYPE.ARMOR: rNum = Random.Range(0, 2); switch (rNum) { default: case 0: max = Player.ForgeLv; break; case 1: max = Player.SewingLv; break; } break; case Items.ITEM_TYPE.TOOL: max = Player.AlchmicLv; break; default: break; } int id = Random.Range(0, max); if (!mItemKey[type].ContainsKey(id)) { break; } string key = mItemKey[type][id][Random.Range(0, mItemKey[type][id].Count)]; List <Items> temp = mItemPool[type][id][key]; for (int i = 0; i < temp.Count; i++) { if (!temp[i].UnLock) { break; } if (temp[i].IsUse) { continue; } items = temp[i]; break; } } if (items) { items.IsUse = true; } return(items); }