GetFamily

From Intrigues Wiki
Revision as of 12:23, 5 January 2024 by Tayfunwiki (talk | contribs) (Created page with "=== IM Class - <code>GetFamily</code> Method === ==== Overview ==== The <code>GetFamily</code> method in the IM class is designed to retrieve a specific family within the game's context by its name or ID. ==== Syntax ==== <syntaxhighlight lang="c#"> public static Family GetFamily(string familyNameOrId) </syntaxhighlight> ==== Description ==== This method locates a family within the game's active list of families using either its name or ID. If a matching family is fou...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

IM Class - GetFamily Method

Overview

The GetFamily method in the IM class is designed to retrieve a specific family within the game's context by its name or ID.

Syntax

public static Family GetFamily(string familyNameOrId)

Description

This method locates a family within the game's active list of families using either its name or ID. If a matching family is found, it returns the corresponding Family object.

Example of Usage

public class FamilyManager : MonoBehaviour {
    void DisplayFamilyInfo() {
        // Retrieve a family by name or ID
        var family = IM.GetFamily("House Stark");

        // Check if the family exists and display its details
        if (family != null) {
            Debug.Log($"Family Name: {family.FamilyName}");
            Debug.Log($"Family Description: {family.Description}");
            // Additional display logic can be added here
        } else {
            Debug.Log("Family not found.");
        }
    }
}

Remarks

  • This method is vital for accessing and managing family-related dynamics in the game, such as displaying family histories, alliances, or rivalries.
  • The accuracy of family retrieval depends on the exact match of the provided name or ID with those in the game's family database.