feat: 支持手势引导

This commit is contained in:
richarjiang
2025-09-28 15:45:53 +08:00
parent 1a6580e195
commit 869a33431c
35 changed files with 2343 additions and 18 deletions

View File

@@ -48,10 +48,15 @@ export class PlayerController extends Component {
// 道具列表
private props: Node[] = [];
private guideNode: Node | null = null;
onLoad() {
this.guideNode = this.canvas.node.getChildByName('Guide');
// 注册触摸事件
input.on(Input.EventType.TOUCH_START, this.onTouchStart, this);
let collider = this.player.getComponent(Collider2D);
if (collider) {
// 监听碰撞事件
@@ -130,6 +135,8 @@ export class PlayerController extends Component {
private onTouchStart(event: EventTouch) {
if (!this.player || !this.camera || !this.pathfinder || this.isAttacking || this.isGameOver || this.isWin) return;
this.guideNode.active = false;
// 获取触摸点的UI坐标
const touchLocation = event.getUILocation();