IM.OnTrigger

From Intrigues Wiki
Revision as of 13:19, 4 January 2024 by Tayfunwiki (talk | contribs) (Created page with "== <code>onTrigger</code> Event in IM Class == === Overview === The <code>onTrigger</code> event in the IM (Intrigue Manager) class is designed to respond to specific conditions within the game, particularly those involving triggers activated by the TriggerNode. === Description === * Event Type: <code>Action<Scheme, string, bool></code> * Functionality: ** This event is triggered under certain conditions, and it carries along three parameters: a <code>Scheme</code> ob...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

onTrigger Event in IM Class

Overview

The onTrigger event in the IM (Intrigue Manager) class is designed to respond to specific conditions within the game, particularly those involving triggers activated by the TriggerNode.

Description

  • Event Type: Action<Scheme, string, bool>
  • Functionality:
    • This event is triggered under certain conditions, and it carries along three parameters: a Scheme object, a string identifier, and a bool status.
    • It is configured to handle triggers that are activated specifically through the 'Scheme' input of a TriggerNode, offering a focused mechanism for responding to scheme-related events within the game.

Usage

The onTrigger event is crucial for capturing and handling trigger events that are set off via the 'Scheme' input of the TriggerNode. This allows for targeted responses to events directly tied to specific schemes, enhancing the interactivity and narrative depth of the game.

Note

  • TriggerNode Integration: The event is particularly attuned to listening for triggers that are activated through the 'Scheme' input of the TriggerNode. This enables the event to specifically handle triggers related to particular schemes, making it an essential tool for scheme-based gameplay mechanics and storytelling.

Example of Usage

public class SchemeTriggerHandler : MonoBehaviour {
    void OnEnable() {
        IM.onTrigger += HandleSchemeTrigger;
    }

    void OnDisable() {
        IM.onTrigger -= HandleSchemeTrigger;
    }

    private void HandleSchemeTrigger(Scheme scheme, string triggerId, bool status) {
        Debug.Log($"Scheme Trigger Activated: {triggerId}, Status: {status}, In Scheme: {scheme.SchemeName}");
        // Implement logic to respond to the scheme-specific trigger event
        // This could involve changing the course of the scheme, updating game states, or initiating new narrative paths
    }
}

Description:

  • HandleSchemeTrigger: This method, subscribed to the onTrigger event, is invoked when a trigger related to a specific scheme is activated. It processes the received information, allowing for responses tailored to the context of the scheme.

Remarks

  • The onTrigger event is a vital component for games that employ complex scheme systems, where triggers play a significant role in unfolding events and shaping the player's experience.
  • Proper implementation of this event handler enables developers to create dynamic and responsive gameplay, where player actions or environmental changes can have meaningful impacts on ongoing schemes.