public SaveItemClass(Item i) { this.itm_Name = i.itm_Name; this.itm_Desc = i.itm_Desc; this.itm_FullName = i.itm_FullName; this.itm_Lore = i.itm_Lore; this.itm_Type = i.itm_Type; this.itm_Slot = i.itm_Slot; this.itm_Value = i.itm_Value; this.itm_Quality = i.itm_Quality; this.itm_AttackBonus = i.itm_AttackBonus; this.itm_MinDamage = i.itm_MinDamage; this.itm_MaxDamage = i.itm_MaxDamage; this.itm_DefenseBonus = i.itm_DefenseBonus; this.itm_MaxCharges = i.itm_MaxCharges; this.itm_MaxFuel = i.itm_MaxFuel; this.itm_Icon = i.itm_Icon; this.itm_ID_Quality = i.itm_ID_Quality; this.itm_ID_Damage = i.itm_ID_Damage; this.itm_ID_Defense = i.itm_ID_Defense; this.itm_ID_Charges = i.itm_ID_Charges; this.itm_ID = i.itm_ID; this.itm_Active = i.itm_Active; this.itm_CurrentCharges = i.itm_CurrentCharges; this.itm_CurrentFuel = i.itm_CurrentFuel; }
public void _on_BlocksList_item_selected(int index) { Item.Type type = Item.grindable[index]; blockSelected = type; SetDescription(type); Refresh(); }
private void SetDescription(Item.Type type) { imageDesc.Texture = Item.textures[(int)type]; titleDesc.Text = type.ToString(); energyDesc.Text = "-> " + Grinder.power + "e"; descriptionDesc.Text = "With " + Item.ToComposite[blockSelected] + " of " + blockSelected + ", you make " + "1 Composite"; }
private GameObject CreateItem(Item.Type type) { spawnEffect.Play(); FMODUnity.StudioEventEmitter x = GetComponent <FMODUnity.StudioEventEmitter> (); if (x != null) { x.Play(); } switch (type) { case Item.Type.SUPER_BOOST: GameObject boost = Instantiate(atlas.fireBoostItem); boost.AddComponent <ItemController>().type = type; return(boost); case Item.Type.STICKY_THROWABLE: GameObject throwable = Instantiate(atlas.snowballItem); throwable.AddComponent <ItemController>().type = type; return(throwable); case Item.Type.BANANA_THROWABLE: GameObject banana = Instantiate(atlas.bananaItem); banana.AddComponent <ItemController>().type = type; return(banana); default: return(null); } }
public override void TakeDamageFrom(AbstractController enmy, bool bumpRight, float force) { if (isActiveAndEnabled) { rigid.velocity = Vector2.zero; Vector2 bumpDir = bumpRight ? Vector2.right : Vector2.left; rigid.AddForce(bumpDir * force); Item.Type dropType = Item.Type.NONE; for (int i = (int)Item.Type.copperCoin; i <= (int)Item.Type.goldCoin; ++i) { Item.Type type = (Item.Type)i; if (Has(type)) { dropType = type; } } if (dropType != Item.Type.NONE) { DropAllItemsOfType(dropType); audioSource.PlayOneShot(hurtSound); } else { anim.SetBool("Dead", true); audioSource.PlayOneShot(deathSound); enabled = false; } anim.SetTrigger("Hurt"); } }
public void Create(IInventoryHolder target, Vector2 pos, Item.Type type) { follow = target; transform.position = pos; transform.parent = ParticleGenerator.holder; this.type = type; }
public void SetItem(Item.Type type) { if (type == Item.Type.BlackBall) { Box0.SetActive(true); } }
public void StartFirstGatheringQuest() { if (MainQuester == null) { return; } List <QuestReward> qRewards = new List <QuestReward>(); List <QuestRequirement> qReqs = new List <QuestRequirement>(); const Item.Type copper = Item.Type.Copper; qReqs.Add(new GatheringQReq(copper, 2, MainChar, "Obtain {0} {1} from asteroids: {2} / {0}")); const Item.Type iron = Item.Type.Iron; qReqs.Add(new GatheringQReq(iron, MainChar, "Obtain {0} {1} from asteroids: {2} / {0}")); Quest q = new Quest( "Gather materials", "We need some materials so that we can repair our communications system. Once that" + " is done, we should be able to find our way back to Dendro and the ship.", MainQuester, qRewards, qReqs); q.OnQuestComplete += CompletedFirstGatheringQuest; GiveQuest(MainQuester, q); ActivateScriptedDrops(true); StartDialogue(useThrustersConversation, true); TutPrompts?.drillInputPromptInfo.SetIgnore(false); }
public bool Craft(CraftingRecipe recipe) { List <ItemStack> ingredients = recipe.IngredientsCopy; for (int i = 0; i < ingredients.Count; i++) { ItemStack stack = ingredients[i]; Item.Type type = stack.ItemType; Storage inv = GetAppropriateInventory(type); if (ItemStack.Count(inv.ItemStacks, type) < stack.Amount) { return(false); } } defaultInventory.RemoveItems(ingredients); List <ItemStack> results = recipe.ResultsCopy; if (!defaultInventory.CanFit(results)) { defaultInventory.AddItems(ingredients); return(false); } OnItemsCrafted?.Invoke(results); defaultInventory.AddItems(results); return(true); }
public void addPart(Item.Type part) { switch (part) { case Item.Type.Olli_ArmLeft: partSlot[0] = true; break; case Item.Type.Olli_ArmRight: partSlot[1] = true; break; case Item.Type.Olli_LegLeft: partSlot[2] = true; break; case Item.Type.Olli_LegRight: partSlot[3] = true; break; case Item.Type.Olli_Body: partSlot[4] = true; break; } updateBody(); }
public bool Unequip(Item.Type type) { Item equipNulo = new Item(); equipNulo.equipType = type; return(EquipToPlayer(equipNulo)); }
public List <Item> SortItemsByType(int group) { List <Item> newList = new List <Item>(); Item.Type itemType = itemPages[group]; groupName.text = itemType.ToString(); if (group > (int)Item.Type.Inventory) { foreach (Item item in inventory.items) { if (item.inventoryType == itemType) { newList.Add(item); } } } else { newList.AddRange(inventory.items); } return(newList); }
public Loot(Item.Type type, int minAmount, int maxAmount, float lootChance) { this.type = type; this.minAmount = Mathf.Min(minAmount, maxAmount); this.maxAmount = Mathf.Max(minAmount, maxAmount); this.lootChance = Mathf.Clamp01(lootChance); }
public static Recipe[] getByIgredient(Item.Type get) { int count = 0; bool[] wanted = new bool[recipes.Length]; for (int i = 0; i < recipes.Length; i++) { if (recipes[i].ingredients[0] == get || recipes[i].ingredients[1] == get || recipes[i].ingredients[2] == get || recipes[i].ingredients[3] == get) { count++; wanted[i] = true; } else { wanted[i] = false; } } Recipe[] ret = new Recipe[count]; count = 0; for (int i = 0; i < recipes.Length; i++) { if (wanted[i]) { ret[count] = recipes[i]; count++; } } return(ret); }
private static void CreateRecipeFromStrings(string[] ingsS, string[] ingAmountS, string stationS, string resultS, string amountS) { Item.Type ing1 = (Item.Type)Enum.Parse(typeof(Item.Type), ingsS[0]); Item.Type ing2 = (Item.Type)Enum.Parse(typeof(Item.Type), ingsS[1]); Item.Type ing3 = (Item.Type)Enum.Parse(typeof(Item.Type), ingsS[2]); Item.Type ing4 = (Item.Type)Enum.Parse(typeof(Item.Type), ingsS[3]); int[] ingAmount; if (ingAmountS == null) { ingAmount = null; } else { ingAmount = new int[4]; for (int i = 0; i < ingAmountS.Length; i++) { ingAmount[i] = 0; Int32.TryParse(ingAmountS[i], out ingAmount[i]); } } CraftingStationType station = (CraftingStationType)Enum.Parse(typeof(CraftingStationType), stationS); Item.Type result = (Item.Type)Enum.Parse(typeof(Item.Type), resultS); int amount = 0; Int32.TryParse(amountS, out amount); Recipe recipe = new Recipe(new Item.Type[] { ing1, ing2, ing3, ing4 }, ingAmount, station, result, amount); insertRecipe(recipe); }
public void UseItem(Item.Type type) { if (type == Item.Type.BlackBall) { Box0.SetActive(false); } }
public Recipe(ResourceType item1, ResourceType item2, Item.Type equipType) { this.item1 = item1; this.item2 = item2; this.equipType = equipType; }
public void SetItemType(Item.Type type) { SetImage(type); SetItemName(type); SetDescription(type); SetFlavourText(type); }
public void Createitem(Item.Type type, Item item) { Transform createParent = null; switch (type) { case Item.Type.建筑单位: createParent = building_Item_Create; break; case Item.Type.步兵单位: createParent = people_Item_Create; break; case Item.Type.装甲单位: createParent = tank_Item_Create; break; case Item.Type.飞行单位: createParent = plane_Item_Create; break; } Resources_Management.Instance.Load <GameObject>("UI/Unit", createParent, (itemToggle) => { Item_Info info = itemToggle.GetComponent <Item_Info>();//找到当前组件下的脚本,进行传参赋值 info.NameData(item); all_ItemObj.Add(itemToggle); all_Item_Script.Add(info); }); }
public void addItem(Item.Type type) { if (!hasFreeSlots) { Debug.LogError("Trying to add new item to a busy belt " + type); return; } Vector3 spawnPos = position; spawnPos.y = 1; Item item = new Item(); item.id = System.Guid.NewGuid(); item.type = type; item.position = spawnPos; item.parent = position; GameGrid.Instance.items.Add(item.id, item); GameGrid.Instance.itemsToCreate.Enqueue(item.id); // GameObject obj = GameGrid.Instantiate(GameGrid.Instance.getItemInfo(type).prefab, spawnPos, Quaternion.Euler(-90, 0, 0), gameObject.transform); addToItems(item.id, type); }
private void GeneratePopup(Item.Type type, int amount = 1) { PopupData data = new PopupData(sprites, type, amount); foreach (ItemPopupObject ipo in activePopups) { if (ipo.Data.ItemType == type) { ipo.AddAmount(data.Amount); return; } } for (int i = 0; i < popupsToShow.Count; i++) { PopupData pd = popupsToShow[i]; if (pd.ItemType == type) { pd.AddAmount(amount); return; } } if (ViewingLimitReached) { popupsToShow.Add(data); } else { ItemPopupObject po = GetAnInactivePopup; po.Data = data; } }
public static ItemGene Random(Item.Type type) { var collection = Item.Items[type]; var index = rnd.Next(collection.Count()); return(new ItemGene(collection[index])); }
public void StartCraftYourFirstRepairKitQuest() { if (MainChar == null) { return; } List <QuestReward> qRewards = new List <QuestReward>(); List <QuestRequirement> qReqs = new List <QuestRequirement>(); const Item.Type repairKit = Item.Type.RepairKit; qReqs.Add(new CraftingQReq(repairKit, MainChar, "Construct {0} {1} using 2 copper and 1 iron")); Quest q = new Quest( "Construct a Repair Kit", "Now that we have the necessary materials, we should try constructing a repair kit.", MainQuester, qRewards, qReqs); q.OnQuestComplete += CompletedCraftYourFirstRepairKitQuest; GiveQuest(MainQuester, q); TutPrompts?.pauseInputPromptInfo.SetIgnore(false); }
/// <summary> /// Convert the block type to a bitflag. /// TODO move this to item.type? /// </summary> /// <param name="itemType"></param> /// <returns></returns> static int GetSolidBlockBitflags(Item.Type itemType) { int solidBlockFlags = 0; int blockIndex = 0; (int shapeWidth, int shapeHeight) = itemType.ShapeSize; for (int x = 0; x < 3; x++) { // if we're not in bounds it's not solid if (x >= shapeWidth) { break; } else { for (int y = 0; y < 3; y++) { // if we're not in bounds it's not solid if (y >= shapeHeight) { break; } else if (itemType.Shape[x, y] != Item.Type.ShapeBlocks.Empty) { solidBlockFlags = solidBlockFlags.TurnBitOn(++blockIndex); } } } } return(solidBlockFlags); }
public bool AssignItem(int index, Item.Type type) { if (index > spawners.Length) { return(false); } return(spawners[index].SpawnItem(type)); }
public void AssignItemAtRandom() { nextSpawnTime = Time.time + minimumCooldown; int index = Random.Range(0, spawners.Length); Item.Type type = RandomItemType(); AssignItem(index, type); }
public ItemUseQReq(Item.Type typeNeeded, int amountNeeded, IInventoryHolder inventoryHolder, string description = null) : base(description != null ? description : "Use {0} {1}: {2} / {0}", null) { this.typeNeeded = typeNeeded; this.amountNeeded = amountNeeded; this.inventoryHolder = inventoryHolder; }
public bool CanUseItem(Item.Type type) { if (type == Item.Type.BlackBall) { return(Box0.activeSelf); } return(false); }
private void UpdateStack(int index, Item.Type type, int amount) { if (index != ID) { return; } SetStack(type, amount); }
public CraftingQReq(Item.Type typeNeeded, int amountNeeded, ICrafter crafter, string description = null) : base(string.IsNullOrWhiteSpace(description) ? "Craft {0} {1}: {2} / {0}" : description, null) { this.typeNeeded = typeNeeded; this.amountNeeded = amountNeeded; this.crafter = crafter; }
public Item(GraphicsContext g, Collision c, Vector3 pos, Item.Type i, Vector4 uc) { type = i; s = new Sprite(g, new Texture2D("/Application/Assets/weaponbase.png", false)); s.Position = pos; s.SetColor(uc); graphics = g; col = c; IsAlive = true; }