AddChild
AddChild
Methods in Actor Class
Overview
The AddChild
methods in the Actor
class are designed to add a child to the actor, either as a single parent or with a specified spouse. These methods are crucial in games where character relationships, lineage, and family dynamics are key elements of gameplay, narrative, or character development.
Method 1: Add Child as Single Parent
Syntax
public void AddChild(Actor child, bool joinFamily = true, bool setOrigin = true)
Parameters
child
(Actor): The Actor object representing the child to be added.joinFamily
(bool): Optional. If true, the child will automatically join the actor's family. Defaults totrue
.setOrigin
(bool): Optional. If true, sets the child's origin family to the current actor's family. Defaults totrue
.
Description
This method allows an actor to add a child, optionally including the child in the actor's family and setting the child's origin family to be the same as the actor's.
Usage Example
public Actor parent;
public Actor child;
// Parent adds a child with automatic family joining and setting origin family
parent.AddChild(child);
In this example, the parent actor adds a child. The child automatically joins the parent's family, and the parent's family is set as the child's origin family.
Method 2: Add Child with Specified Spouse
Syntax
public void AddChild(Actor spouse, Actor child, bool joinFamily = true, bool setOrigin = true)
Parameters
spouse
(Actor): The Actor object representing the other parent of the child.child
(Actor): The Actor object representing the child to be added.joinFamily
(bool): Optional. If true, the child will automatically join the family. Defaults totrue
.setOrigin
(bool): Optional. If true, sets the child's origin family to the current actor's family. Defaults totrue
.
Description
This method enables an actor, along with a specified spouse, to add a child. It includes options for the child to join the family and for setting the child's origin family.
Usage Example
public Actor mother;
public Actor father;
public Actor child;
// Mother and father add a child with automatic family joining and setting origin family
mother.AddChild(father, child);
In this example, a mother and father jointly add a child. The child is automatically included in their family, and the family is established as the child's origin family.
Remarks
- These methods provide flexibility for representing complex family structures within the game, allowing for single parent or dual parent scenarios.
- The options to join the family and set the origin family are important for the accurate portrayal of family dynamics and lineage.
- The
AddChild
methods are crucial in narrative-driven games, role-playing games, or any game where character relationships and family heritage significantly influence the story and gameplay.