예제 #1
0
 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;
 }
예제 #2
0
 public void _on_BlocksList_item_selected(int index)
 {
     Item.Type type = Item.grindable[index];
     blockSelected = type;
     SetDescription(type);
     Refresh();
 }
예제 #3
0
 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";
 }
예제 #4
0
    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);
        }
    }
예제 #5
0
    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");
        }
    }
예제 #6
0
 public void Create(IInventoryHolder target, Vector2 pos, Item.Type type)
 {
     follow             = target;
     transform.position = pos;
     transform.parent   = ParticleGenerator.holder;
     this.type          = type;
 }
예제 #7
0
 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);
    }
예제 #9
0
    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);
    }
예제 #10
0
    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();
    }
예제 #11
0
    public bool Unequip(Item.Type type)
    {
        Item equipNulo = new Item();

        equipNulo.equipType = type;
        return(EquipToPlayer(equipNulo));
    }
예제 #12
0
    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);
    }
예제 #13
0
 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);
 }
예제 #14
0
    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);
    }
예제 #15
0
    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);
    }
예제 #16
0
 public void UseItem(Item.Type type)
 {
     if (type == Item.Type.BlackBall)
     {
         Box0.SetActive(false);
     }
 }
예제 #17
0
 public Recipe(ResourceType item1, ResourceType item2,
               Item.Type equipType)
 {
     this.item1     = item1;
     this.item2     = item2;
     this.equipType = equipType;
 }
예제 #18
0
 public void SetItemType(Item.Type type)
 {
     SetImage(type);
     SetItemName(type);
     SetDescription(type);
     SetFlavourText(type);
 }
예제 #19
0
    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);
        });
    }
예제 #20
0
        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);
        }
예제 #21
0
        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;
            }
        }
예제 #22
0
파일: ItemGene.cs 프로젝트: 2021SIA/TP2
        public static ItemGene Random(Item.Type type)
        {
            var collection = Item.Items[type];
            var index      = rnd.Next(collection.Count());

            return(new ItemGene(collection[index]));
        }
예제 #23
0
    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);
    }
예제 #24
0
    /// <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);
    }
예제 #25
0
 public bool AssignItem(int index, Item.Type type)
 {
     if (index > spawners.Length)
     {
         return(false);
     }
     return(spawners[index].SpawnItem(type));
 }
예제 #26
0
    public void AssignItemAtRandom()
    {
        nextSpawnTime = Time.time + minimumCooldown;
        int index = Random.Range(0, spawners.Length);

        Item.Type type = RandomItemType();
        AssignItem(index, type);
    }
예제 #27
0
 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;
 }
예제 #28
0
 public bool CanUseItem(Item.Type type)
 {
     if (type == Item.Type.BlackBall)
     {
         return(Box0.activeSelf);
     }
     return(false);
 }
예제 #29
0
 private void UpdateStack(int index, Item.Type type, int amount)
 {
     if (index != ID)
     {
         return;
     }
     SetStack(type, amount);
 }
예제 #30
0
 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;
 }
예제 #31
0
 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;
 }