コード例 #1
0
        private void TransferToInentoryPlayerFromGround()
        {
            GameObject toAdd = CellContained.GetItem().gameObject;

            player.TakeItemFromInventory(toAdd);
            CellContained.RemoveOneFromCompteur();
            Control.CreateCellsForNearbyItem();
        }
コード例 #2
0
 private void ClickOnWeaponButton()
 {
     if (CellContained.GetItem() as Weapon)
     {
         Inventory.UnequipWeaponAt(EquipAt);
     }
     else if (CellContained.GetItem() as Grenade)
     {
         Inventory.UnequipGrenade();
     }
 }
コード例 #3
0
 private void ClickOnProtectionButton()
 {
     if (CellContained.GetItem() as Helmet)
     {
         Inventory.UnequipHelmet();
     }
     else if (CellContained.GetItem() as Vest)
     {
         Inventory.UnequipVest();
     }
     else if (CellContained.GetItem() as Bag)
     {
         Inventory.UnequipBag();
     }
 }
コード例 #4
0
        private void SetImageBackground()
        {
            ItemSpriteSelector itemSpriteSelector = Control.GetComponent <ItemSpriteSelector>();
            ItemType           type      = CellContained.GetItem().Type;
            Sprite             newSprite = null;

            if (type == ItemType.AmmoPack)
            {
                newSprite = itemSpriteSelector.GetSpriteForType(type, 0, (CellContained.GetItem() as AmmoPack).AmmoType, true);
            }
            else
            {
                newSprite = itemSpriteSelector.GetSpriteForType(type, CellContained.GetItem().Level);
            }
            ImageBackground.sprite = newSprite;
        }
コード例 #5
0
        private string GetNameOfCellObject()
        {
            string name;
            Item   containedInCell = CellContained.GetItem();

            if (containedInCell.Type == ItemType.AmmoPack)
            {
                name = (containedInCell as AmmoPack).AmmoType.ToString();
            }
            else
            {
                name = containedInCell.Type.ToString();
            }
            int      level       = containedInCell.Level;
            ItemType typeToCheck = containedInCell.Type;

            if (level != 0)
            {
                name = GetNameFromItemWithLevel(level, typeToCheck);
            }

            return(name);
        }
コード例 #6
0
        private void ClickOnInventoryButton()
        {
            if (willDropItem)
            {
                Inventory.Drop(CellContained);
            }
            else if (CellContained.GetItem() as Grenade)
            {
                Inventory.EquipGrenade(CellContained);
            }
            else if (CellContained.GetItem() as Weapon)
            {
                Inventory.EquipWeaponAt(EquipAt, CellContained);
            }
            else if (CellContained.GetItem() as Helmet)
            {
                Inventory.EquipHelmet(CellContained);
            }
            else if (CellContained.GetItem() as Vest)
            {
                Inventory.EquipVest(CellContained);
            }
            else if (CellContained.GetItem() as Heal || CellContained.GetItem() as Boost)
            {
                //Bug fix temporaire
                CellContained.GetItem().Player = player.gameObject;
                //Fin bug fix temporaire

                (CellContained.GetItem() as Usable).Use();
                Inventory.CheckMultiplePresenceAndRemove(CellContained);
            }
            else if (CellContained.GetItem() as Bag)
            {
                Inventory.EquipBag(CellContained);
            }
        }