public ContentsManagerInfo getCurrentContents() { contentInfo.contents.Clear(); for (int i = 0; i < slotsParent.transform.childCount; i++) { GameObject slot = slotsParent.transform.GetChild(i).gameObject; if (slot.transform.childCount > 0) { GameObject slotteditem = slot.transform.GetChild(0).gameObject; //ContentType.contentItem childContent = (ContentType.contentItem) System.Enum.Parse (typeof(ContentType.contentItem), slotteditem.name.ToString()); ContentType.contentItem tileContentType = slotteditem.GetComponent <tileDetail> ().tileContentType; contentInfo.contents.Add(tileContentType); } else //empty slot { contentInfo.contents.Add(ContentType.contentItem.none); } } return(contentInfo); }
WeaponInfo getItemforRecipe(ContentType.contentItem ingredient, int ingredientCount) { //2 metals = dagger //3 metals = sword //4 metals = greatsword gameControl = GameObject.Find("GameControl"); int damageMultiplier = 1; if (ingredient == ContentType.contentItem.copper_ingot || ingredient == ContentType.contentItem.iron_ingot) { if (ingredient == ContentType.contentItem.copper_ingot) { damageMultiplier = 1; } if (ingredient == ContentType.contentItem.iron_ingot) { damageMultiplier = 2; } WeaponInfo.weaponTypes newWeaponType = WeaponInfo.weaponTypes.none; switch (ingredientCount) { case 2: newWeaponType = WeaponInfo.weaponTypes.Dagger; break; case 3: newWeaponType = WeaponInfo.weaponTypes.LongSword; break; case 4: newWeaponType = WeaponInfo.weaponTypes.GreatSword; break; } WeaponTemplate template = gameControl.GetComponent <CraftingManager> ().getTemplateforType(newWeaponType); return(new WeaponInfo(template, damageMultiplier)); } return(null); //2 berries = weak hp potion //3 berries = med hp potion //4 berries = strong hp potion //2 wood = short bow //3 wood = recurve box //4 wood = longbox }