RpgGame
Console Based RPG game in C#
Loading...
Searching...
No Matches
RpgGame.Items.IItem Interface Reference

Defines the contract for all items that can exist within the game world. More...

Inheritance diagram for RpgGame.Items.IItem:
Collaboration diagram for RpgGame.Items.IItem:

Public Member Functions

string GetDescription ()
 Returns a short textual description of the item.
 
bool OnPickup (Player player, Inventory inventory)
 Handles the pickup interaction for the item.
 
void OnDrop (Level level, Player player)
 Handles the drop interaction for the item.
 

Properties

string Name [get]
 Gets the display name of the item.
 
char Symbol [get]
 Gets the character symbol used to render the item on the map.
 
ConsoleColor color [get]
 Gets the console color used to render the Items on the map.
 

Detailed Description

Defines the contract for all items that can exist within the game world.

Implementations of IItem represent objects that can:

  • Be displayed on the map using a symbol.
  • Provide a textual description.
  • React to pickup interactions.
  • Be dropped onto the level.

The pickup behavior may vary depending on the item type. For example, equippable items attempt to occupy a specific hand, while consumable items (such as coins) apply their effect immediately.

Member Function Documentation

◆ GetDescription()

string RpgGame.Items.IItem.GetDescription ( )

Returns a short textual description of the item.

Returns
A human-readable description of the item.

Implemented in RpgGame.Items.Coin, RpgGame.Items.Gold, RpgGame.Items.Potion, RpgGame.Items.Thorn, and RpgGame.Items.Weapon.

◆ OnDrop()

void RpgGame.Items.IItem.OnDrop ( Level  level,
Player  player 
)

Handles the drop interaction for the item.

Parameters
levelThe current level.
playerThe player dropping the item.

Implemented in RpgGame.Items.Coin, RpgGame.Items.Gold, RpgGame.Items.Potion, RpgGame.Items.Thorn, and RpgGame.Items.Weapon.

Here is the caller graph for this function:

◆ OnPickup()

bool RpgGame.Items.IItem.OnPickup ( Player  player,
Inventory  inventory 
)

Handles the pickup interaction for the item.

Parameters
playerThe player interacting with the item.
pickUpLeftIndicates whether the pickup action targets the left hand. This parameter is primarily relevant for equippable items.
Returns
True if the pickup action was successful; otherwise false.

Implemented in RpgGame.Items.Coin, RpgGame.Items.Gold, RpgGame.Items.Potion, RpgGame.Items.Thorn, and RpgGame.Items.Weapon.

Property Documentation

◆ color

ConsoleColor RpgGame.Items.IItem.color
get

Gets the console color used to render the Items on the map.

Implemented in RpgGame.Items.Coin, RpgGame.Items.DoubleSword, RpgGame.Items.Gold, RpgGame.Items.Potion, RpgGame.Items.Sword, RpgGame.Items.Thorn, and RpgGame.Items.Weapon.

◆ Name

string RpgGame.Items.IItem.Name
get

◆ Symbol

char RpgGame.Items.IItem.Symbol
get

Gets the character symbol used to render the item on the map.

Implemented in RpgGame.Items.Coin, RpgGame.Items.DoubleSword, RpgGame.Items.Gold, RpgGame.Items.Potion, RpgGame.Items.Sword, RpgGame.Items.Thorn, and RpgGame.Items.Weapon.


The documentation for this interface was generated from the following file: