Banker - jimdroberts/FishMMO GitHub Wiki

Description

Represents a banker NPC that allows players to access their bank storage. Inherits from Interactable. Displays a custom title and color in the UI.


API Access

Properties

  • public override string Title { get; }

    The display title for the banker, shown in the UI.

  • public override Color TitleColor { get; }

    The color of the title displayed for the banker in the UI. Uses a goldenrod color for distinction.


Basic Usage

Setup

  1. Attach the Banker component to an NPC GameObject in your scene.
  2. Ensure the GameObject also has a SceneObjectNamer component (required).
  3. The NPC will display the title "Banker" in goldenrod color in the UI.

Example

// Example 1: Setting up a Banker NPC in the Unity Editor
// 1. Add the Banker script to an NPC GameObject.
// 2. Ensure SceneObjectNamer is also attached.
// 3. The NPC will now allow players to access their bank storage.

// Example 2: Accessing the title and color in code
var banker = GetComponent<Banker>();
Debug.Log(banker.Title); // Outputs: Banker
Debug.Log(banker.TitleColor);

Best Practices

  • Always attach SceneObjectNamer to GameObjects with Banker to ensure proper naming in the scene.
  • Use the Title and TitleColor properties to customize UI display for different interactable NPCs.
  • Extend Banker for more advanced banking logic or UI if needed.
⚠️ **GitHub.com Fallback** ⚠️