import { Vector2 } from "three/src/Three"; import { Component } from "../../hierarchy_object/Component"; import type { IGridCollidable } from "./IGridCollidable"; /** * object collide map for grid system * * this component store overlap information of collider * so if you add collider twice at same position, remove must be called twice * * 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 GridObjectCollideMap extends Component implements IGridCollidable { private readonly _collideMap; private _gridCellWidth; private _gridCellHeight; private _showCollider; private _colliderIsShowing; private readonly _colliderImages; private _collideEnabled; private readonly _initializeFunctions; private _started; start(): void; onEnable(): void; onDisable(): void; /** * add collider at position * @param x x position in grid * @param y y position in grid * @returns */ addCollider(x: number, y: number): void; /** * add collider from two dimensional array. array left bottom is (0, 0) in grid coordinate system * @param array array that contains 1 or 0. 1 means collider is there * @param xOffset array x offset, if you want to add collider from array[1][3] to (2, 3) you should set xOffset = 1 * @param yOffset array y offset, if you want to add collider from array[3][1] to (3, 2) you should set yOffset = 1 * @returns */ addColliderFromTwoDimensionalArray(array: (1 | 0)[][], xOffset: number, yOffset: number): void; /** * remove collider at position * @param x x position in grid * @param y y position in grid * @returns */ removeCollider(x: number, y: number): void; private addColliderImages; private removeColliderImages; private addDebugImage; private removeDebugImage; /** * query that collides at position * @param x world position x * @param y world position y * @param width collison width * @param height collision height * @returns if collides, return true. otherwise, return false */ checkCollision(x: number, y: number, width: number, height: number): 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 collide map will visualized as debug image (default: false) */ get showCollider(): boolean; /** * if this value is true, grid collide map will visualized as debug image (default: false) */ set showCollider(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; }