Role.SetCapacity
Role Class - SetCapacity
Method
Overview
The SetCapacity
method in the Role class allows setting the maximum number of individuals who can occupy a specific role simultaneously.
Syntax
public void SetCapacity(int capacity)
Description
This method is used to define or modify the capacity of a role, which is the maximum number of actors that can hold this role at any given time. The capacity
parameter is an integer representing this limit.
Usage
The method is particularly useful in scenarios where certain roles need to be limited in number, such as exclusive positions or titles within a clan or organization.
Example of Usage
public class RoleManager : MonoBehaviour {
void SetRoleCapacity() {
// Retrieve a specific role, for instance, "Guard"
var role = IM.GetRole("Guard");
// Set a new capacity for the "Guard" role
role.SetCapacity(10); // Max 10 guards allowed
}
}
Remarks
- Adjusting the capacity of a role can impact the game's dynamics, especially in scenarios involving hierarchy, power balance, or resource allocation.
- It's important to carefully consider the implications of changing a role's capacity, as it can significantly affect gameplay and player strategy.