Lemmings
Remappable Gestures For Unity
Loading...
Searching...
No Matches
Lemmings.LemmingShepherd Class Reference

Singleton container responsible for managing active Lemmings and their associated relationships. Provides central tracking, registration, and runtime access to all active Lemming objects and their connections to LemmingRelationships, supporting UI, analysis, and dynamic manipulation across scenes. More...

Inherits MonoBehaviour.

Public Member Functions

void Register (Lemming lemming)
 Registers a Lemming to the shepherd if it has not already been added.
void Unregister (Lemming lemming)
 Unregisters a Lemming and removes any relationship mappings associated with it.
void RegisterRelationship (LemmingRelationship relationship)
 Registers a LemmingRelationship, maps all involved Lemmings to it, and stores descriptive metadata.
void UnregisterRelationship (LemmingRelationship relationship)
 Removes a LemmingRelationship from tracking, including cleaning up all lemming-to-relationship mappings.
void InitializeHerd ()
void ValidateScene ()
 Scans all registered relationships and removes any that no longer reference any registered Lemmings. Useful for cleaning up after scene changes or tracking loss.

Properties

static LemmingShepherd Instance [get, private set]
static List< LemmingAll [get]
 Provides static access to all currently registered Lemmings.
List< LemmingLemmings = new() [get, private set]
List< LemmingRelationshipRelationships = new() [get, private set]
Dictionary< Lemming, List< LemmingRelationship > > LemmingToRelationships = new() [get, private set]
Dictionary< LemmingRelationship, LemmingRelationshipInfoRelationshipDetails = new() [get, private set]
IEnumerable<(LemmingRelationship relationship, LemmingRelationshipInfo info)> ValidRelationships [get]
IEnumerable< LemmingValidLemmings [get]

Private Member Functions

void Awake ()
 Establish the Instance as singular and set it to remain active through scene changes.
void Update ()
 This updates the shepherd's dictionary and the Scriptable Object concurrently. The scriptable object can't update itself for each frame and so this calls it from the scene. This way you can access the data from either the SO or the Shepherd, depending on your project structure.
string GetRoleForLemming (string name, LemmingRelationship relationship)
 Attempts to resolve a role name for a Lemming based on its assigned name in the relationship mapping.

Detailed Description

Singleton container responsible for managing active Lemmings and their associated relationships. Provides central tracking, registration, and runtime access to all active Lemming objects and their connections to LemmingRelationships, supporting UI, analysis, and dynamic manipulation across scenes.

Member Function Documentation

◆ GetRoleForLemming()

string Lemmings.LemmingShepherd.GetRoleForLemming ( string name,
LemmingRelationship relationship )
inlineprivate

Attempts to resolve a role name for a Lemming based on its assigned name in the relationship mapping.

Parameters
nameThe name of the Lemming.
relationshipThe relationship context for resolution.
Returns
The assigned role if found, otherwise "Unknown".

◆ Register()

void Lemmings.LemmingShepherd.Register ( Lemming lemming)
inline

Registers a Lemming to the shepherd if it has not already been added.

Parameters
lemmingThe Lemming component to be registered.

◆ RegisterRelationship()

void Lemmings.LemmingShepherd.RegisterRelationship ( LemmingRelationship relationship)
inline

Registers a LemmingRelationship, maps all involved Lemmings to it, and stores descriptive metadata.

Parameters
relationshipThe LemmingRelationship instance to register.

◆ Unregister()

void Lemmings.LemmingShepherd.Unregister ( Lemming lemming)
inline

Unregisters a Lemming and removes any relationship mappings associated with it.

Parameters
lemmingThe Lemming component to be removed.

◆ UnregisterRelationship()

void Lemmings.LemmingShepherd.UnregisterRelationship ( LemmingRelationship relationship)
inline

Removes a LemmingRelationship from tracking, including cleaning up all lemming-to-relationship mappings.

Parameters
relationshipThe LemmingRelationship instance to remove.

The documentation for this class was generated from the following file:
  • Assets/Lemmings/Scripts/Classes/LemmingShepherd.cs