Skip to content

@ue-too/board-game-engine / index / ValueComparisonPrecondition

類別: ValueComparisonPrecondition<T> ​

定義於: action-system/precondition.ts:26

Unified value comparison precondition that works with both custom schema components and typed components. Automatically detects which approach to use based on whether the component has a registered schema.

範例 ​

typescript
// With custom schema component
const precondition1 = new ValueComparisonPrecondition(
    100, '>', coordinator, HEALTH_COMPONENT, entity, 'health'
);

// With typed component (type-safe)
type HealthComponent = { health: number; maxHealth: number };
const precondition2 = new ValueComparisonPrecondition<HealthComponent>(
    coordinator, HEALTH_COMPONENT, entity, 'health', 100, '>'
);

型別參數 ​

T ​

T = Record<string, unknown>

實作 ​

建構函式 ​

建構函式 ​

new ValueComparisonPrecondition<T>(coordinator, componentName, entity, valuePath, value, operator): ValueComparisonPrecondition<T>

定義於: action-system/precondition.ts:37

參數 ​

coordinator ​

Coordinator

componentName ​

symbol

entity ​

number

valuePath ​

keyof T

value ​

number

operator ​

">" | "<" | ">=" | "<=" | "==" | "!="

回傳 ​

ValueComparisonPrecondition<T>

建構函式 ​

new ValueComparisonPrecondition<T>(value, operator, coordinator, componentName, entity, valuePath): ValueComparisonPrecondition<T>

定義於: action-system/precondition.ts:46

參數 ​

value ​

number

operator ​

">" | "<" | ">=" | "<=" | "==" | "!="

coordinator ​

Coordinator

componentName ​

symbol

entity ​

number

valuePath ​

string

回傳 ​

ValueComparisonPrecondition<T>

方法 ​

check() ​

check(): boolean

定義於: action-system/precondition.ts:102

回傳 ​

boolean

實作了 ​

Precondition.check