Pause: Difference between revisions

From Intrigues Wiki
(Created page with "== <code>Pause</code> Method in Scheme Class == === Overview === The <code>Pause</code> method in the Scheme class is used to temporarily halt the progression of a scheme. This functionality is important in scenarios where the game needs to suspend the actions or effects of a particular scheme temporarily. === Syntax === <syntaxhighlight lang="c#"> public void Pause() </syntaxhighlight> === Description === * The method checks if the <code>Schemer</code> (the controll...")
 
No edit summary
 
Line 22: Line 22:
         Scheme schemeToPause = IM.Player.GetScheme(schemeName);
         Scheme schemeToPause = IM.Player.GetScheme(schemeName);
         if (schemeToPause != null) {
         if (schemeToPause != null) {
             schemeToPause.Pause();
             schemeToPause.Schemer.Pause();
             Debug.Log($"Paused scheme: {schemeName}");
             Debug.Log($"Paused scheme: {schemeName}");
         } else {
         } else {

Latest revision as of 17:59, 9 February 2024

Pause Method in Scheme Class

Overview

The Pause method in the Scheme class is used to temporarily halt the progression of a scheme. This functionality is important in scenarios where the game needs to suspend the actions or effects of a particular scheme temporarily.

Syntax

public void Pause()

Description

  • The method checks if the Schemer (the controlling entity of the scheme) is not null before calling the Pause method on it. This ensures that the scheme can be paused only if it is actively being managed or executed.

Usage

This method is typically used in game logic where there is a need to pause schemes due to various gameplay events, such as dialogue interactions, cutscenes, or specific player actions that require suspension of ongoing schemes.

Example of Usage

public class SchemeController : MonoBehaviour {
    void PausePlayerScheme(string schemeName) {
        Scheme schemeToPause = IM.Player.GetScheme(schemeName);
        if (schemeToPause != null) {
            schemeToPause.Schemer.Pause();
            Debug.Log($"Paused scheme: {schemeName}");
        } else {
            Debug.Log($"Scheme not found: {schemeName}");
        }
    }
}

Description

  • In the PausePlayerScheme method, the example demonstrates how to pause a specific scheme. It retrieves the scheme by its name using IM.Player.GetScheme and then calls the Pause method on the retrieved scheme.
  • The method logs whether the specified scheme was successfully paused or if the scheme was not found.

Remarks

  • The Pause method is a key part of managing schemes within a game, allowing for greater control over the game's narrative and mechanics.
  • It's important to handle the paused state of schemes properly in the game's logic to ensure a seamless player experience.