feat: 完成寻路系统接口设计

This commit is contained in:
AncTe committed 2026-09-09 16:40:56 +08:00
1 parent 67c0806f7f
commit 7a011b29c2
3 files changed
+157 -12

No files matched your search

+6 -12
View File
@@ -13,6 +13,7 @@ import {
IObjectMover,
ISaveableContent
} from '@user/data-common';
import { IPassPredicate } from '../map';
//#region 勇士属性
@@ -300,6 +301,11 @@ export interface IHeroMoveTopHandler extends IDataCommonExtended {
}
export interface IHeroMoveTopImpl {
/**
* 获取用于检查通行性的谓词对象
*/
predicate(): IPassPredicate;
/**
* 检查目标位置是否在地图范围内
* @param x 横坐标
@@ -308,18 +314,6 @@ export interface IHeroMoveTopImpl {
*/
inBound(x: number, y: number, floorId: string | undefined): boolean;
/**
* 判断在指定楼层中,从指定坐标向指定方向移动一格是否可通行
* @param handler 通行性检查对象
*/
canPass(handler: IHeroMoveTopHandler): boolean;
/**
* 判断在指定楼层中,从指定坐标向指定方向移动时是否应该产生撞击,撞击将会触发目标位置的撞击触发器
* @param handler 通行性检查对象
*/
shouldHit(handler: IHeroMoveTopHandler): boolean;
/**
* 勇士正常移动到某个图块上时触发进入触发器
* @param handler 移动信息对象
+29
View File
@@ -889,3 +889,32 @@ export interface IMapState
}
//#endregion
//#region 通行检测
export interface IPassCheckHandler extends IDataCommonExtended {
/** 当前位置 */
readonly currLoc: ITileLocator;
/** 要移动至的位置 */
readonly nextLoc: ITileLocator;
/** 移动方向 */
readonly direction: FaceDirection;
/** 当前楼层 id */
readonly floorId: string | undefined;
}
export interface IPassPredicate {
/**
* 检查在指定楼层中,能否从某一个移动入某一格
* @param handler 通行性检查信息对象
*/
canPass(handler: IPassCheckHandler): boolean;
/**
* 检查在指定楼层中,从某一个移动至某一格时是否会产生撞击行为
* @param handler 通行性检查信息对象
*/
shouldHit(handler: IPassCheckHandler): boolean;
}
//#endregion