public void AddEquip(int id)
    {
        GameObject newEquip;
        Item       equip = itemDB.GetItemByID(id);

        newEquip = (GameObject)Instantiate(equip.UIPrefab, transform);
        newEquip.transform.parent     = transform;
        newEquip.transform.localScale = new Vector3(1.0f, 1.0f);
    }
示例#2
0
    public void AddToGrid(int id, int amount = 1)
    {
        Item item = itemDB.GetItemByID(id);

        switch (item.Category)
        {
        case Item.ItemCategory.EQUIPMENT:
            equipGrid.AddToGrid(item.UIPrefab, amount);
            break;

        case Item.ItemCategory.USE:
            useGrid.AddToGrid(item.UIPrefab, amount);
            break;

        case Item.ItemCategory.ETC:
            etcGrid.AddToGrid(item.UIPrefab, amount);
            break;
        }
    }
    public void DropItems(Vector2 position)
    {
        ItemDB db = GameObject.FindGameObjectWithTag("GameController").GetComponent <ItemDB>();

        foreach (int i in itemIds)
        {
            GameObject item = (GameObject)Instantiate(db.GetItemByID(i).DropPrefab, position, Quaternion.identity);

            float randomXForce = Random.Range(-2.5f, 2.5f);

            //Max them seem like they kind of burst out of the enemy
            item.GetComponent <PhysicsObject>().AddForce(new Vector2(randomXForce, 3.0f) * Time.deltaTime);
        }
    }
    public void OnPointerDown(PointerEventData data)
    {
        clicks++;
        clicked = true;

        if (clicks >= 2)
        {
            clicks  = 0;
            seconds = 0;

            clicked = false;

            db.GetItemByID(item.itemID).Action();
        }
    }
示例#5
0
 // Update is called once per frame
 void Update()
 {
     //If you press the button associated with the hotkey slot
     if (Input.GetKeyDown(keyPress))
     {
         int id = hotkey.id;                                           //Get the id of the item or skill the player is going to use
         if (id != -1)                                                 //If there's actually something in the hotkey slot
         {
             if (hotkey.hotkeyType.Equals(Hotkey.HotkeyType.ITEM))     //If it's an item
             {
                 UsableItem item = (UsableItem)itemDB.GetItemByID(id); //Get the actual item
                 item.Action();                                        //Perform the action associated with the item
             }
             else //If it's a skill
             {
                 Skill skill = (Skill)skillDB.GetSkillByID(id); //Get the actual skill
                 skill.UseSkill();                              //Use the skill
             }
         }
     }
 }
示例#6
0
 public Weapon GetWeapon()
 {
     return((Weapon)itemDB.GetItemByID(equips["Weapon"]));
 }