Children

From Intrigues Wiki
Revision as of 11:52, 21 December 2023 by Tayfunwiki (talk | contribs) (Created page with "== <code>Children</code> Method in Actor Class == === Overview === The <code>Children</code> method in the <code>Actor</code> class is designed to retrieve the children of an actor. It offers the flexibility to include or exclude deceased children based on a specified parameter. === Syntax === <syntaxhighlight lang="c#"> public IEnumerable<Actor> Children(bool inclusivePassive = true) </syntaxhighlight> === Parameters === * <code>inclusivePassive</code> (bool): A boo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Children Method in Actor Class

Overview

The Children method in the Actor class is designed to retrieve the children of an actor. It offers the flexibility to include or exclude deceased children based on a specified parameter.

Syntax

public IEnumerable<Actor> Children(bool inclusivePassive = true)

Parameters

  • inclusivePassive (bool): A boolean flag that determines whether deceased (passive state) children should be included in the returned collection. It defaults to true.

Returns

  • Return Type: IEnumerable<Actor>. This method returns a collection of Actor objects representing the children of the actor.
  • If inclusivePassive is true, both living and deceased children are included.
  • If inclusivePassive is false, only living (active state) children are included.

Description

The Children method is essential for accessing the children of an actor, with an option to consider the state (alive or dead) of these children. The inclusion of deceased children is controlled by the inclusivePassive parameter.

Usage

This method is useful in game mechanics or narratives where an actor's relationship with their children, including those who may have passed away, is important.

Example:

var allChildren = someActor.Children();
var livingChildren = someActor.Children(false);

In the first example, allChildren will contain all the children of the actor, regardless of their state. In the second example, livingChildren will only include the living children of the actor.

Remarks

  • This flexibility in handling children based on their state allows for nuanced storytelling and gameplay, especially in scenarios involving family dynamics and inheritance.
  • The Children method plays a vital role in managing familial relationships and lineage within the game.