Kill

From Intrigues Wiki
Revision as of 19:00, 9 February 2024 by Tayfunwiki (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Kill Method in Scheme Class

Overview

The Kill method in the Scheme class is used to terminate a scheme immediately. This method is crucial for stopping the progression of a scheme, especially in scenarios where the scheme's continuation is no longer relevant or desired within the game's context.

Syntax

public void Kill(bool dontGoEnd = false)

Description

  • Parameters:
    • dontGoEnd (optional, defaults to false): If set to true, this parameter prevents the scheme from reaching its end node, effectively stopping the scheme without triggering its conclusion logic.
  • The method first checks if the Schemer (the entity controlling the scheme) is not null before proceeding to terminate the scheme.

Usage

The Kill method is typically used in game logic to forcibly end a scheme due to various gameplay events, such as changes in the game's narrative, player decisions, or other conditions that render the continuation of the scheme irrelevant or counterproductive.

Example of Usage

public class SchemeTerminator : MonoBehaviour {
    void TerminatePlayerScheme(string schemeName) {
        Scheme schemeToKill = IM.Player.GetScheme(schemeName);
        if (schemeToKill != null) {
            schemeToKill.Schemer.Kill();
            Debug.Log($"Terminated scheme: {schemeName}");
        } else {
            Debug.Log($"Scheme not found: {schemeName}");
        }
    }
}

Description

  • In the TerminatePlayerScheme method, this example demonstrates how to terminate a specific scheme by name. It retrieves the scheme using IM.Player.GetScheme and then calls the Kill method on it.
  • The method logs a message indicating whether the scheme was successfully terminated or if it was not found.

Remarks

  • The Kill method is a key tool for managing schemes within a game, allowing for greater control over the narrative and gameplay.
  • Proper handling of the termination of schemes is crucial to maintain the integrity and consistency of the game's narrative and mechanics.