Loading...
Searching...
No Matches
CityBuilderCore.IItemGiver Interface Reference

Detailed Description

building component that provides others with items

Inheritance diagram for CityBuilderCore.IItemGiver:
CityBuilderCore.IBuildingTrait< IItemGiver > CityBuilderCore.IItemOwner CityBuilderCore.CollectionComponent CityBuilderCore.IStorageComponent CityBuilderCore.StorageComponent CityBuilderCore.StorageWalkerComponent

Public Member Functions

int GetGiveQuantity (Item item)
 checks how much of an item is available to be given
 
void ReserveQuantity (Item item, int quantity)
 reserves a quantity of items that may later be given
dont reverse more than is available(GetGiveQuantity(Item))
 
void UnreserveQuantity (Item item, int quantity)
 releases a quantity that was reserved by ReserveQuantity(Item, int) before
should be called before acutally moving items with Give(ItemStorage, Item, int) or if the process was interrupted
 
int Give (ItemStorage storage, Item item, int quantity)
 requests that a quantity of items is put into the specified storage
if the full amount is not available the remaining quantity is returned
 

Additional Inherited Members

- Properties inherited from CityBuilderCore.IBuildingTrait< IItemGiver >
BuildingComponentReference< T > Reference [get, set]
 reference to the building trait, use when the building might be replaced and when the reference has to be saved
 
- Properties inherited from CityBuilderCore.IItemOwner
IItemContainer ItemContainer [get]
 holds and manages the items for the owner
 

Member Function Documentation

◆ GetGiveQuantity()

int CityBuilderCore.IItemGiver.GetGiveQuantity ( Item item)

checks how much of an item is available to be given

Parameters
itemthe wanted item
Returns
unreserved quantity available

Implemented in CityBuilderCore.CollectionComponent, and CityBuilderCore.StorageComponent.

◆ Give()

int CityBuilderCore.IItemGiver.Give ( ItemStorage storage,
Item item,
int quantity )

requests that a quantity of items is put into the specified storage
if the full amount is not available the remaining quantity is returned

Parameters
storagethe storage the items will be added to
itemthe item to give
quantitythe desired quantity
Returns
the remaining quantity that was not available

Implemented in CityBuilderCore.CollectionComponent, and CityBuilderCore.StorageComponent.

◆ ReserveQuantity()

void CityBuilderCore.IItemGiver.ReserveQuantity ( Item item,
int quantity )

reserves a quantity of items that may later be given
dont reverse more than is available(GetGiveQuantity(Item))

Parameters
itemwanted item
quantityquantity of the item

Implemented in CityBuilderCore.CollectionComponent, and CityBuilderCore.StorageComponent.

◆ UnreserveQuantity()

void CityBuilderCore.IItemGiver.UnreserveQuantity ( Item item,
int quantity )

releases a quantity that was reserved by ReserveQuantity(Item, int) before
should be called before acutally moving items with Give(ItemStorage, Item, int) or if the process was interrupted

Parameters
item
quantity

Implemented in CityBuilderCore.CollectionComponent, and CityBuilderCore.StorageComponent.