Role.RoleName
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.