Skip to content

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

クラス: PropertyIsPrecondition<T>

定義: action-system/precondition.ts:191

Precondition that checks if a property in a component of an entity equals a certain value. Supports multiple types (number, string, boolean, etc.) and 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 PropertyIsPrecondition(
    coordinator, HEALTH_COMPONENT, entity, 'status', 'active'
);

// With typed component (type-safe)
type PlayerComponent = { name: string; level: number; isActive: boolean };
const precondition2 = new PropertyIsPrecondition<PlayerComponent>(
    coordinator, PLAYER_COMPONENT, entity, 'name', 'John'
);

型パラメーター

T

T = Record<string, unknown>

実装

コンストラクター

コンストラクター

new PropertyIsPrecondition<T>(coordinator, componentName, entity, property, value): PropertyIsPrecondition<T>

定義: action-system/precondition.ts:200

パラメータ

coordinator

Coordinator

componentName

symbol

entity

number

property

string | keyof T

value

unknown

戻り値

PropertyIsPrecondition<T>

メソッド

check()

check(): boolean

定義: action-system/precondition.ts:214

戻り値

boolean

の実装

Precondition.check