DungeonEntrance - jimdroberts/FishMMO GitHub Wiki

Description

Interactable representing a dungeon entrance. Displays a title and optional image in the UI.


API Access

Fields

  • private string title

    The display title for the dungeon entrance, shown in the UI.

  • public string DungeonName

    The name of the dungeon associated with this entrance.

  • public Image DungeonImage

    The image representing the dungeon entrance in the UI (client only).

Properties

  • public override string Title { get; }

    Gets the display title for the dungeon entrance.


Basic Usage

Setup

  1. Attach the DungeonEntrance component to an interactable GameObject in your scene.
  2. Set the DungeonName and (optionally) assign a DungeonImage in the Inspector.
  3. The entrance will display the title and image in the UI when interacted with.

Example

// Example 1: Setting up a DungeonEntrance in the Unity Editor
// 1. Add the DungeonEntrance script to an interactable GameObject.
// 2. Set the DungeonName and assign a DungeonImage if desired.
// 3. The GameObject will now act as a dungeon entrance in the UI.

// Example 2: Accessing the title in code
var entrance = GetComponent<DungeonEntrance>();
Debug.Log(entrance.Title); // Outputs: Dungeon
Debug.Log(entrance.DungeonName);

Best Practices

  • Use DungeonEntrance for objects that represent entrances to dungeons or special areas.
  • Assign a unique DungeonName for each entrance to distinguish them in the UI and logic.
  • Optionally assign a DungeonImage to enhance the UI experience for players.
  • Extend DungeonEntrance for custom logic or effects if needed.
⚠️ **GitHub.com Fallback** ⚠️