Parents
Parents
Method in Actor Class
Overview
The Parents
method in the Actor
class is used to retrieve the parents of an actor. It allows for the inclusion or exclusion of deceased parents based on the specified parameter.
Syntax
public IEnumerable<Actor> Parents(bool inclusivePassive = true)
Parameters
inclusivePassive
(bool): A flag indicating whether to include deceased (passive state) parents in the returned collection. It defaults totrue
.
Returns
- Return Type:
IEnumerable<Actor>
. The method returns a collection ofActor
objects representing the parents of the specified actor. - When
inclusivePassive
istrue
, it includes all parents regardless of their state (alive or dead). - When
inclusivePassive
isfalse
, it only includes parents who are in an active (alive) state.
Description
The Parents
method is designed to provide access to the actor's parental figures. The method's behavior can be controlled through the inclusivePassive
parameter, allowing users to specify whether they want to include parents who have passed away (Passive state) in the collection.
Usage
This method is particularly useful in scenarios where the actor's familial background, including the state of their parents (alive or dead), plays a role in the gameplay or narrative.
Example:
var livingParents = someActor.Parents(false);
var allParents = someActor.Parents();
In these examples, livingParents
will contain only living parents of the actor, while allParents
will include both living and deceased parents.
Remarks
- The ability to include or exclude deceased parents provides flexibility in how parental relationships are handled within the game's logic or story.
- The method is a part of handling complex family trees and relationships within the game, enhancing the depth and realism of character interactions and narratives.