Exemple #1
0
        public bool IsOutBorderInventory(DataInventory inventory, DataEntity dataEntity, Vector2Int coordinateSlotLeftTop)
        {
            if (inventory.TypeInventory != DataInventory.TypeInventoryEnum.GridSupportMultislotEntity)
            {
                return(false);
            }
            var targetSlots    = GetSlots(inventory, dataEntity.GetArea(coordinateSlotLeftTop));
            int countSlotsArea = dataEntity.Dimensions.x * dataEntity.Dimensions.y;

            return(countSlotsArea > targetSlots.Count());
        }
Exemple #2
0
        public IEnumerable <DataSlot> GetSlotsForEntityInInventory(DataInventory inventory, Vector2Int position,
                                                                   DataEntity dataEntity)
        {
            var result = new List <DataSlot>();
            var isOutBorderInventory = IsOutBorderInventory(inventory, dataEntity, position);

            Contract.Assert(!isOutBorderInventory, "IsOutBorderInventory!");
            if (inventory.TypeInventory == DataInventory.TypeInventoryEnum.GridSupportMultislotEntity)
            {
                result = GetSlots(inventory, dataEntity.GetArea(position)).ToList();
            }
            else
            {
                result.Add(GetSlotOrNull(inventory, position));
            }
            return(result);
        }