Overworld Merchant

🏪 OverworldMerchant Class

A merchant in the game world that can be interacted with.

Namespace: Esper.Inventool.Merchants Access: public Type: class Inherits: MonoBehaviour


📦 Fields

Access
Field
Type
Description

private

merchant

Merchant

The merchant reference.

private

inRangeIndicator

GameObject

An object that is enabled when the player is in range of the merchant.

public

interactionAction

Action

The action to invoke when Interact() is called.

public static

activeMerchant

OverworldMerchant

The merchant the player is currently in range of. null if not in range.


🧰 Methods

Access
Method
Returns
Description

protected virtual

Awake()

void

Initializes the merchant and sets the default interaction action.

public

OpenInventoolWindow()

void

Opens the appropriate Inventool window for this merchant.

public

Interact()

void

Invokes the current interactionAction.

private

OnTriggerEnter(Collider other)

void

Activates the in‑range indicator and sets this as the active merchant when the player enters range.

private

OnTriggerEnter2D(Collider2D collision)

void

Same as OnTriggerEnter but for 2D collisions.

private

OnTriggerExit(Collider other)

void

Deactivates the in‑range indicator, clears activeMerchant, and closes merchant windows when the player exits range.

private

OnTriggerExit2D(Collider2D collision)

void

Same as OnTriggerExit but for 2D collisions.


Active Merchant

You can get the active merchant (the merchant currently in range) with the OverworldMerchant.activeMerchant field.

Interaction

You can use the Interact method to interact with a merchant. Interacting with a merchant will open the UI for the specific merchant type (depends on the merchant field).

myMerchant.Interact();

Last updated