Role.SetIcon

From Intrigues Wiki

Role Class - SetIcon Method

Overview

The SetIcon method in the Role class allows setting a new graphical icon for a specific role.

Syntax

public void SetIcon(Sprite icon)

Description

This method updates the visual representation of a role by assigning a new Sprite object as its icon. This is useful for UI elements or any other in-game representations where roles are visually distinguished.

Usage

This method is commonly used when customizing or updating the visual aspects of roles within the game, making it easier for players to identify different roles at a glance.

Example of Usage

public class RoleIconUpdater : MonoBehaviour {
    public Sprite newGuardIcon; // Assign this in the Unity inspector

    void UpdateGuardIcon() {
        // Retrieve the "Guard" role
        var guardRole = IM.GetRole("Guard");

        // Update the icon for the "Guard" role
        guardRole.SetIcon(newGuardIcon);
    }
}

Remarks

  • It's important to ensure that the icon accurately represents the role's nature and function within the game.
  • Changing a role's icon can be a part of a larger UI update or rebranding within the game.