Culture.AddName

From Intrigues Wiki
Revision as of 22:32, 4 January 2024 by Tayfunwiki (talk | contribs) (Created page with "== <code>AddName</code> Method in Culture Class == === Overview === The <code>AddName</code> method in the Culture class enables the addition of a new name to the culture's list of names, specifically categorized by gender. This functionality is key to expanding and customizing the range of names within a specific cultural context in a game. === Method Definition === <syntaxhighlight lang="c#"> public Culture AddName(string name, Actor.IGender gender) </syntaxhighlight...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

AddName Method in Culture Class

Overview

The AddName method in the Culture class enables the addition of a new name to the culture's list of names, specifically categorized by gender. This functionality is key to expanding and customizing the range of names within a specific cultural context in a game.

Method Definition

public Culture AddName(string name, Actor.IGender gender)

Parameters

  • name: The name to be added.
  • gender: The gender category (Male or Female) for which the name is suitable.

Description

  • This method adds the provided name to the appropriate list (male or female names) based on the specified gender.
  • Returns the updated Culture instance, allowing for additional method chaining or further modifications.
  • It is a versatile tool for dynamically expanding the cultural names database as per gameplay or story requirements.

Usage

This method can be used for:

  • Introducing new character names to reflect evolving storylines or player choices.
  • Expanding the cultural name pool for more diverse character creation options.
  • Allowing players or game developers to customize the cultural aspects of the game world.

Example of Usage

public class CultureNameAdder : MonoBehaviour {
    public string newName;
    public Actor.IGender genderForName;

    void Start() {
        // Retrieve the current culture of the player
        Culture playerCulture = IM.Player.Culture;

        if (playerCulture != null && !string.IsNullOrEmpty(newName)) {
            // Add the new name to the culture
            playerCulture.AddName(newName, genderForName);
            Debug.Log($"Added Name: {newName} for Gender: {genderForName}");
        }
    }
}

An example of how to use the AddName method:

Description

  • The script retrieves the player's current culture using IM.Player.Culture.
  • It then adds the provided newName to the culture's name list for the specified genderForName.
  • The addition of the new name is confirmed through a debug log.

Remarks

  • Ensure the added names are culturally appropriate and align with the game's theme and storyline.
  • This method facilitates the ongoing development and customization of the game's cultural aspects.
  • Consider how the addition of new names might affect game balance and player interactions.