Role.RoleName

From Intrigues Wiki
Revision as of 10:14, 5 January 2024 by Tayfunwiki (talk | contribs) (Created page with "=== Role Class - <code>RoleName</code> Property === ==== Overview ==== The <code>RoleName</code> property in the Role class identifies the name of a role assigned to a character in the game. ==== Syntax ==== <syntaxhighlight lang="c#"> [field: SerializeField] public string RoleName { get; private set; } </syntaxhighlight> ==== Description ==== This property provides a human-readable name for a role, such as "Doctor," "Warrior," or "Leader." It is used to identify the...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Role Class - RoleName Property

Overview

The RoleName property in the Role class identifies the name of a role assigned to a character in the game.

Syntax

[field: SerializeField] public string RoleName { get; private set; }

Description

This property provides a human-readable name for a role, such as "Doctor," "Warrior," or "Leader." It is used to identify the role's function and significance within the game's narrative and mechanics.

Usage

Use RoleName to access the name of a role for display purposes, in-game logic, or when interfacing with other game systems.

Example of Usage

public class RoleDisplay : MonoBehaviour {
    void Start() {
        // Access the player's role
        var playerRole = IM.Player.Role;

        if (playerRole != null) {
            // Output the name of the player's role
            Debug.Log($"Player's Role: {playerRole.RoleName}");
        }
    }
}

Remarks

  • This property is essential for any situation where the name of a role needs to be displayed or used in game logic.
  • Understanding the role of a character is crucial for gameplay decisions, narrative development, and player interaction.