Role.ID

From Intrigues Wiki

Role Class - ID Property

Overview

The ID property in the Role class uniquely identifies each role within the game.

Syntax

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

Description

This property holds a unique identifier for a role, ensuring that each role can be distinctly recognized and referred to within the game's systems. It's crucial for managing roles in gameplay, scripting, and data storage.

Usage

Use ID to reference or manipulate specific roles in game logic, such as assigning roles to actors or triggering role-specific events.

Example of Usage

public class RoleManager : MonoBehaviour {
    private Role leaderRole;

    void Start() {
        // Fetching the 'Leader' role
        leaderRole = IM.GetRole("Leader");

        if (leaderRole != null) {
            Debug.Log($"Leader Role ID: {leaderRole.ID}");
        }
    }
}

Remarks

  • The ID is typically used in scenarios where roles need to be identified or processed programmatically.
  • It is crucial for maintaining consistency and accuracy in role management, especially in complex systems involving multiple roles.