Family.IsMember

From Intrigues Wiki
Revision as of 22:44, 4 January 2024 by Tayfunwiki (talk | contribs) (Created page with "== <code>IsMember</code> Method in Family Class == === Overview === The <code>IsMember</code> method in the Family class is used to check if a specific actor is a member of the family. This functionality is crucial in games where family affiliations and relationships play a significant role in the gameplay, story, or character interactions. === Method Definition === <syntaxhighlight lang="c#"> public bool IsMember(Actor member) </syntaxhighlight> === Parameters === *...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

IsMember Method in Family Class

Overview

The IsMember method in the Family class is used to check if a specific actor is a member of the family. This functionality is crucial in games where family affiliations and relationships play a significant role in the gameplay, story, or character interactions.

Method Definition

public bool IsMember(Actor member)

Parameters

  • member: The Actor object to be checked for membership in the family.

Returns

  • Boolean: Returns true if the specified actor is a member of the family; otherwise, returns false.

Usage

This method can be utilized to verify family connections, which can be pivotal in narrative-driven games or scenarios where family ties impact gameplay mechanics, such as inheritance, alliances, or quests.

Example of Usage

public class FamilyMembershipChecker : MonoBehaviour {
    public Actor actorToCheck;

    void Start() {
        Family playerFamily = IM.Player.Family;
        if (playerFamily != null && actorToCheck != null) {
            bool isMember = playerFamily.IsMember(actorToCheck);
            Debug.Log($"{actorToCheck.Name} is a member of the player's family: {isMember}");
        }
    }
}

Description

  • This example demonstrates how to use the IsMember method to check if a given actor (actorToCheck) is part of the player's family.
  • The script logs whether the specified actor is a family member, providing a straightforward way to ascertain family affiliations.

Remarks

  • The IsMember method is particularly useful in games that feature complex family trees or where family membership has a direct impact on the player's decisions or interactions.