예제 #1
0
        public IItem CreateSwordItem(SpriteBatch spriteBatch, Vector2 startingPos, bool kept, bool resetKept, int type)
        {
            IItem add = new SwordItem(this.spriteBatch, textures["sword"], startingPos, kept, resetKept, type);

            RoomItems.Instance.AddItem(add);
            return(add);
        }
예제 #2
0
 public Item QuickSetEquipment(Item item)
 {
     if (item is HeadItem)
     {
         HeadItem head = item as HeadItem;
         HeadItem old  = _headSlot.ChangeItem(head);
         return(old);
     }
     else if (item is FootItem)
     {
         FootItem foot = item as FootItem;
         FootItem old  = _footSlot.ChangeItem(foot);
         return(old);
     }
     else if (item is BodyItem)
     {
         BodyItem body = item as BodyItem;
         BodyItem old  = _bodySlot.ChangeItem(body);
         return(old);
     }
     else if (item is SwordItem)
     {
         SwordItem sword = item as SwordItem;
         return(_swordSlot.ChangeItem(sword));
     }
     return(item);
 }
예제 #3
0
    public List <SwordItem> GetAllSwords()
    {
        List <SwordItem> swords = new List <SwordItem>();

        for (int i = 0; i < m_items.Count; ++i)
        {
            SwordItem sword = m_items[i] as SwordItem;
            if (sword != null)
            {
                swords.Add(sword);
            }
        }

        return(swords);
    }
예제 #4
0
    public override List <InventoryItem> UpdateInventoryWeapons(InventoryManager playerInventory, InventoryManager bodyInventory)
    {
        List <SwordItem>     playerSwords = playerInventory.GetAllSwords();
        List <InventoryItem> ret          = new List <InventoryItem>();

        defaultSword         = bodyInventory.defaultSword;
        defaultSword.manager = playerInventory;
        ret.Add(defaultSword);
        for (int i = 0; i < playerSwords.Count; ++i)
        {
            ret.Add(playerSwords[i]);
        }

        WeaponSelectionUI.instance.SetAvailableWeapons(ret);
        UpdateWeaponSelectedUI(playerInventory.equippedSword);

        playerInventory.OnNewSwordEquipped += UpdateWeaponSelectedUI;

        return(ret);
    }
 public void setItem(Item item)
 {
     this.item = item;
     this.GetComponent <SpriteRenderer>().sprite = item.itemSprite;
     Debug.Log(item.name);
     if (item is SwordItem)
     {
         SwordItem ti = (SwordItem)item;
         Debug.Log("Attack= " + ti.attack);
     }
     if (item is ShieldItem)
     {
         ShieldItem ti = (ShieldItem)item;
         Debug.Log("Attack= " + ti.defense);
     }
     foreach (KeyValuePair <ItemBonus, float> entry in item.bonuses)
     {
         Debug.Log("Additional " + entry.Key + "= " + entry.Value);
     }
 }
예제 #6
0
    private void Awake()
    {
        m_items = new List <InventoryItem>();

        if (defaultSwordData != null)
        {
            defaultSword         = new SwordItem(defaultSwordData.weaponSprite, defaultSwordData);
            defaultSword.manager = this;
            equippedSword        = defaultSword;
        }
        if (defaultStaffData != null)
        {
            defaultStaff         = new ShooterItem(defaultStaffData.shooterSprite, defaultStaffData, true);
            defaultStaff.manager = this;
            equippedStaff        = defaultStaff;
        }
        if (defaultBowData != null)
        {
            defaultBow         = new ShooterItem(defaultBowData.shooterSprite, defaultBowData, false);
            defaultBow.manager = this;
            equippedBow        = defaultBow;
        }
    }
 public void EquipSword(SwordItem newSword)
 {
     inventoryObject.EquipSword(newSword);
     sword.AddItem(newSword);
     sword.ShowIcon(true);
 }
예제 #8
0
 private void UpdateWeaponSelectedUI(SwordItem sword)
 {
     WeaponSelectionUI.instance.ShowSelectedWeapon(sword);
 }
 public void RemoveSword()
 {
     sword = null;
 }
 public void EquipSword(SwordItem newSword)
 {
     sword = newSword;
 }
 public SwordBuilder()
 {
     sword = new SwordItem();
 }