Schemes.ID

From Intrigues Wiki
Revision as of 17:19, 4 January 2024 by Tayfunwiki (talk | contribs) (Created page with "== <code>ID</code> Property in Scheme Class == === Overview === The <code>ID</code> property in the Scheme class represents a unique identifier for each scheme instance in the game. === Property Definition === <syntaxhighlight lang="c#"> [field: SerializeField] public string ID { get; private set; } </syntaxhighlight> === Description === * Attribute: <code>[field: SerializeField]</code> - This attribute allows the <code>ID</code> field to be serialized by Unity, enab...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

ID Property in Scheme Class

Overview

The ID property in the Scheme class represents a unique identifier for each scheme instance in the game.

Property Definition

[field: SerializeField]
public string ID { get; private set; }

Description

  • Attribute: [field: SerializeField] - This attribute allows the ID field to be serialized by Unity, enabling it to be set and viewed in the Unity Editor.
  • Type: string
  • Accessibility: The property is publicly accessible for getting its value but is privately settable, meaning it can only be modified internally within the class or its methods.

Functionality

  • The ID serves as a unique identifier for schemes, ensuring that each scheme instance can be distinctly recognized and referenced.
  • It is particularly important for managing and tracking different schemes in the game, especially when dealing with multiple instances and types of schemes.

Usage

This property is used to access the unique identifier of a scheme. It's crucial in scenarios where specific schemes need to be identified, compared, or tracked throughout the gameplay.

Example of Usage

public class SchemeManager : MonoBehaviour {
    void Start() {
        Scheme currentScheme = IM.Player.GetScheme("Assassination");
        if (currentScheme != null) {
            Debug.Log($"Current scheme ID: {currentScheme.ID}");
        }
    }
}

Description:

  • The Start method in this SchemeManager class demonstrates how to access the ID property of a Scheme object. It logs the unique ID of the current scheme to the console.

Remarks

  • The ID property is a critical aspect of the Scheme class, providing a means to uniquely identify each scheme instance.
  • Proper management of scheme IDs is essential for the integrity of game logic, particularly in complex systems involving multiple schemes and interactions.