Banker - jimdroberts/FishMMO GitHub Wiki
Represents a banker NPC that allows players to access their bank storage. Inherits from Interactable. Displays a custom title and color in the UI.
-
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.
- Attach the Banker component to an NPC GameObject in your scene.
- Ensure the GameObject also has a SceneObjectNamer component (required).
- The NPC will display the title "Banker" in goldenrod color in the UI.
// 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);
- 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.