import { Vector2 } from "three/src/Three"; import { Component } from "../../hierarchy_object/Component"; import type { GameObject } from "../../hierarchy_object/GameObject"; import type { IGridCoordinatable } from "../helper/IGridCoordinatable"; /** * event map for grid system * * coordinate system is same as world coordinate system (positive x is right, positive y is up) * * important: grid position data is stored as string ("x_y" format) * so this component might not work properly if this component's gameObject.position is not integer */ export declare class GridEventMap extends Component implements IGridCoordinatable { private readonly _eventMap; private _gridCellWidth; private _gridCellHeight; private _showCollider; private readonly _eventVisualizeImages; private readonly _initializeFunctions; private _started; start(): void; /** * add event at position * @param x x position in grid * @param y y position in grid * @param callback event callback * @returns */ addEvent(x: number, y: number, callback: (gridX: number, gridY: number, target: GameObject) => void): void; /** * add event from two dimensional array. array left bottom is (0, 0) in grid coordinate system * @param array array that contains event callback * @param xOffset array x offset, if you want to add event from array[1][3] to (2, 3) you should set xOffset = 1 * @param yOffset array y offset, if you want to add event from array[3][1] to (3, 2) you should set yOffset = 1 * @returns */ addEventsFromTwoDimensionalArray(array: (((gridX: number, gridY: number, target: GameObject) => void) | null)[][], xOffset: number, yOffset: number): void; private addVisualizeImages; private removeVisualizeImages; private addDebugImage; /** * invoke event callback if there is event at grid position * @param x world position x * @param y world position y * @param width aabb collision width * @param height aabb collision height * @param target target game object * @returns true if there is event at grid position */ tryInvokeEvent(x: number, y: number, width: number, height: number, target: GameObject): boolean; /** * grid cell width, if this value is not integer, might not work properly (default: 1) */ get gridCellWidth(): number; /** * grid cell width, if this value is not integer, might not work properly (default: 1) */ set gridCellWidth(value: number); /** * grid cell height, if this value is not integer, might not work properly (default: 1) */ get gridCellHeight(): number; /** * grid cell height, if this value is not integer, might not work properly (default: 1) */ set gridCellHeight(value: number); /** * if this value is true, grid event map will visualized as debug image (default: false) */ get showEvents(): boolean; /** * if this value is true, grid event map will visualized as debug image (default: false) */ set showEvents(value: boolean); /** * grid coordinate center position */ get gridCenter(): Vector2; /** * grid coordinate center position x */ get gridCenterX(): number; /** * grid coordinate center position y */ get gridCenterY(): number; }