Actors

From Intrigues Wiki

Actors Property in IM Class

Overview

The Actors property in the IM (Intrigue Manager) class provides access to a collection of actor values. This property is a key element in games managed by the Intrigue Manager, facilitating access to a comprehensive list of Actor instances used within the game's intrigue system.

Description

  • Property Type: IEnumerable<Actor>
  • Accessibility: Public and Static
  • Functionality: Returns an enumerable collection of Actor instances. This collection represents all the actors currently managed by the Intrigue Manager, allowing for iteration over, and operations on, these actor instances.

Usage

The Actors property is used whenever there is a need to access or iterate over all actors in the game. This includes scenarios like updating global game states, applying effects to multiple actors, or conducting searches and queries across the entire set of actors.

Example of Usage

public class ActorListDisplay : MonoBehaviour {
    void DisplayAllActors() {
        foreach (Actor actor in IM.Actors) {
            Debug.Log($"Actor Name: {actor.FullName}");
            // Additional logic to handle each actor
        }
    }
}

In this Unity script example, ActorListDisplay uses the IM.Actors property to iterate over all the actors in the game. For each actor, it logs their full name, and additional logic can be added to handle specific operations for each actor.

Remarks

  • The Actors property in the IM class simplifies the process of accessing and managing multiple actors in a game, enhancing the ease of implementation for global operations.
  • Its enumerable nature allows for flexible usage in various game scenarios, including UI updates, game state management, and actor-specific interactions.