Family.Members

From Intrigues Wiki
Revision as of 22:19, 4 January 2024 by Tayfunwiki (talk | contribs) (Created page with "== <code>Members</code> Property in Family Class == === Overview === The <code>Members</code> property in the Family class is used to access the collection of individuals belonging to a particular family. This property is crucial in games where family structures and relationships are key elements, affecting dynamics such as alliances, inheritances, and storylines. === Property Definition === <syntaxhighlight lang="c#"> public IEnumerable<Actor> Members => members; </sy...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Members Property in Family Class

Overview

The Members property in the Family class is used to access the collection of individuals belonging to a particular family. This property is crucial in games where family structures and relationships are key elements, affecting dynamics such as alliances, inheritances, and storylines.

Property Definition

public IEnumerable<Actor> Members => members;

Description

  • Property Type: IEnumerable<Actor>
  • Access: Read-only
  • Functionality: Retrieves a collection of Actor objects representing the members of the family.

Usage

The property is essential for managing family-related activities and interactions within the game. It allows for the tracking of family members, understanding family dynamics, and implementing mechanics related to lineage, heritage, and familial roles.

Example of Usage

public class FamilyMembersDisplay : MonoBehaviour {
    void Start() {
        Family playerFamily = IM.Player.Family;
        if (playerFamily != null) {
            foreach (Actor member in playerFamily.Members) {
                Debug.Log($"Family Member: {member.Name}");
            }
        }
    }
}

Description

  • In this example, the Members property is used to iterate over and display the names of all members of the player's family.
  • This can be useful for gameplay features such as displaying a family tree or managing family-based quests.

Remarks

  • The Members property is essential for creating a sense of belonging and interconnectedness within the game's social structures.
  • It enables developers to craft stories and scenarios that revolve around family ties and relationships.