Class T3DAliveWithInventory
Unit
CastleItems
Declaration
type T3DAliveWithInventory = class(T3DAlive)
Description
Alive 3D thing that has inventory (can keep items).
Hierarchy
Overview
Methods
Properties
Description
Methods
 |
constructor Create(AOwner: TComponent); override; |
|
 |
destructor Destroy; override; |
|
 |
function PickItemUpdate(var Item: TInventoryItem): Integer; virtual; |
Add given Item to Inventory. Because an item may be stacked with others, the actual Item instance may be freed and replaced with other by this method, that is why Item parameter is "var". Use PickItem method if you don't care about your Item instance.
Returns index to the added item.
Using this method means that the memory management of the item becomes the responsibility of this list.
|
 |
function PickItem(Item: TInventoryItem): Integer; |
Add given Item to Inventory. See PickItemUpdate for details.
This is a shortcut to call PickItemUpdate and then ignore changes to Item instance. Calling this method may be comfortable, but remember that the Item instance possibly doesn't exist after we finish.
|
 |
function DropItem(const Index: Integer): TItemOnWorld; virtual; |
Drop item from Inventory. It is Ok to pass here Index out of range, it will be ignored.
Returns
Droppped item, or Nil if the operation was not completed due to any reason (e.g. no space on 3D world to fit this item). |
 |
procedure UseItem(const Index: Integer); virtual; |
Use an item from Inventory. Calls TInventoryItem.Use, and then checks whether the item was depleted (and eventually removes it from repository). It is Ok to pass here Index out of range, it will be ignored.
|
Properties
Generated by PasDoc 0.13.0 on 2014-08-30 12:10:36
|