public void Comelpete() { player = GameObject.FindGameObjectWithTag("Player").transform; allItem = GameObject.Find("ItemInformationManager").GetComponent <J_ItemInformationManager>(); for (int i = 0; i < allItem.comelpetes.Length; i++) { J_Item _Item = allItem.comelpetes[i].GetComponent <J_Item>(); if (_Item.itemName == J_Mune.mune.buttonNmb.GetComponent <J_ToolButtonInfo>().completeName) { print("완성품입니다"); GameObject a = Instantiate(allItem.comelpetes[i]); a.transform.position = player.position; } } }
//버튼이 클릭 되면 public void OnButtons() { J_ToolMakeButton.j_ToolMakeButton.s = true; j_ItemInformationManager = GameObject.Find("ItemInformationManager").GetComponent <J_ItemInformationManager>(); for (int i = 0; i < j_ItemInformationManager.comelpetes.Length; i++) { if (j_ItemInformationManager.comelpetes[i].GetComponent <J_Item>().itemName == completeName) { comelpete.sprite = j_ItemInformationManager.comelpetes[i].GetComponent <J_Item>().itemImage; } } for (int i = 0; i < aountMat; i++) { s[i] = true; } if (J_Mune.mune.buttonNmb != null) { J_Mune.mune.buttonNmb.GetComponent <Button>().interactable = true; for (int i = 0; i < materials.transform.childCount; i++) { //부모 아래의 자식 게임오브젝트를 삭제하겠다고 알려줍니다 Destroy(materials.transform.GetChild(i).gameObject); } } J_Mune.mune.buttonNmb = gameObject; for (int i = 0; i < aountMat; i++) { //매뉴에 지금 내가 들어갔다고 알려준다 //자기 자신 버튼은 비활성화 해준다 my.interactable = false; for (int j = 0; j < J_ItemManager.j_Item.items2.Length; j++) { if (J_ItemManager.j_Item.items2[j] != null) { if (names[i] == J_ItemManager.j_Item.items2[j].itemName) { //서로 다르기 때문에 앞쪽은 빨강색 뒷 색은 검은색으로표시해줍니다 if (J_ItemManager.j_Item.items2[j].auount < spriteAount[i]) { //텍스트를 빨강색으로 표시해줍니다 stuff.GetComponentInChildren <Text>().text = "<color=#ff0000>" + J_ItemManager.j_Item.items2[j].auount.ToString() + "</color>" + //월래색인 검은색으로 표시합니다 "/" + spriteAount[i].ToString(); s[i] = false; } //필요 재료량보다 가지고 있는 수가 더 많을 수도 있다 else if (J_ItemManager.j_Item.items2[j].auount >= spriteAount[i]) { print("같은 값을 가지고 있어 확인되었습니다"); stuff.GetComponentInChildren <Text>().text = J_ItemManager.j_Item.items2[j].auount.ToString() + "/" + spriteAount[i].ToString(); s[i] = false; } } else { stuff.GetComponentInChildren <Text>().text = "<color=#ff0000>" + 0 + "</color>" + "/" + spriteAount[i].ToString(); } } else if (s[i] == true) { print("설마 들어오냐?"); stuff.GetComponentInChildren <Text>().text = "<color=#ff0000>" + 0 + "</color>" + "/" + spriteAount[i].ToString(); } } stuff.GetComponent <Image>().sprite = sprites[i]; //서로 갯수가 다르면 플레이어 측 아이템 색을 빨강색으로 표시 합니다 //즉 아이템 만드는데 필요한 수량이 부족하다는것은 적다는 것이다 GameObject a = Instantiate(stuff); a.transform.SetParent(materials.gameObject.transform); } }