Role.SetName

From Intrigues Wiki
Revision as of 11:58, 5 January 2024 by Tayfunwiki (talk | contribs) (Created page with "=== Role Class - <code>SetName</code> Method === ==== Overview ==== The <code>SetName</code> method in the Role class allows for changing the name of a specific role. ==== Syntax ==== <syntaxhighlight lang="c#"> public void SetName(string roleName) </syntaxhighlight> ==== Description ==== This method is used to update the name of a role. The <code>roleName</code> parameter specifies the new name to be assigned to the role. ==== Usage ==== Use this method to modify th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Role Class - SetName Method

Overview

The SetName method in the Role class allows for changing the name of a specific role.

Syntax

public void SetName(string roleName)

Description

This method is used to update the name of a role. The roleName parameter specifies the new name to be assigned to the role.

Usage

Use this method to modify the name of a role dynamically during runtime. This can be useful for customizing roles or adapting them to different scenarios within the game.

Example of Usage

public class RoleManager : MonoBehaviour {
    void ChangeRoleName() {
        // Retrieve a specific role, e.g., "Leader"
        var role = IM.GetRole("Leader");

        // Change the name of the role
        role.SetName("Supreme Leader");
    }
}

Remarks

  • Changing the name of a role can have significant impacts on the game's logic and UI, especially if other components are dependent on the role's name.
  • It's recommended to handle the onRoleNameChanged event to update any dependent systems or interfaces when a role's name is changed.