IM.Trigger

From Intrigues Wiki
Revision as of 14:58, 4 January 2024 by Tayfunwiki (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Wait Trigger

Trigger Method in IM Class

Overview

The Trigger method in the IM (Intrigue Manager) class is designed to invoke the onTrigger event, enabling the handling of specific triggers within the game, particularly in relation to schemes.

Description

  • Method Signature: public static void Trigger(Scheme scheme, string triggerName, bool value)
  • Parameters:
    • scheme: The Scheme object related to the trigger.
    • triggerName: A string specifying the name of the trigger.
    • value: A boolean value that is passed along with the trigger, often representing the state or condition of the trigger.

Functionality

  • This method is responsible for invoking the onTrigger event, passing the relevant scheme, trigger name, and value.
  • The method facilitates the communication and response to various game events and conditions tied to specific triggers, especially within the context of a scheme.

Usage

The Trigger method is used to manually activate triggers within the game's logic, particularly for advancing or responding to specific events in a scheme. This can be crucial for gameplay mechanics that depend on event-driven actions and dynamic interactions.

Example of Usage

public class SchemeEventManager : MonoBehaviour {
    public Actor target;

    public void ActivateTrigger() {
        Scheme currentScheme = IM.Player.GetScheme("Assassination", target);
        if(currentScheme == null) return;

        IM.Trigger(currentScheme, "Kill Guardian", true);
    }
}

Description:

  • ActivateTrigger: This method demonstrates how to use the IM.Trigger method to activate a specific trigger in a scheme. It logs the activation for confirmation and traceability.

Remarks

  • The Trigger method is essential in games where triggers play a significant role in advancing schemes or gameplay scenarios.
  • Proper usage of this method allows for a more interactive and responsive gameplay experience, where player actions or game events can lead to specific outcomes or changes in the game state.
  • It is especially relevant in strategy games, narrative-driven games, or any genre that involves complex event systems and conditional gameplay mechanics.