This commit is contained in:
2025-08-05 17:25:34 +08:00
parent 3db3cc78eb
commit 6f9529ada2
20 changed files with 3120 additions and 1623 deletions

View File

@@ -2,7 +2,10 @@ import { HeroViewComp } from "../../../hero/HeroViewComp";
import { BattleMoveComp } from "./BattleMoveComp";
import { ecs } from "../../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { smc } from "../../SingletonModuleComp";
import { BoxSet } from "../../config/BoxSet";
import { BoxSet, FacSet } from "../../config/BoxSet";
import { oops } from "db://oops-framework/core/Oops";
import { GameEvent } from "../../config/GameEvent";
import { FightSet } from "../../config/Mission";
@ecs.register('BattleMoveSystem')
export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
@@ -25,18 +28,19 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU
// 同步状态
if (!shouldStop&&view.fac==1) { //在攻击范围内停止移动 取消这个判断
if (!shouldStop) { //在攻击范围内停止移动 取消这个判断
// if(view.fac==1){
if(view.is_stop||view.is_dead||view.DEBUFF_STUN>0 ||view.DEBUFF_FROST>0) return //停止移动或者死亡不移动
// 新增墓地位置判断,如果已经在墓地则不再移动
if (view.node.position.x === -1000 || view.node.position.x === 1000) {
return;
}
// 计算移动量
const delta = ((view.speed-view.DEBUFF_SLOW)/3) * this.dt * move.direction;
const newX = view.node.position.x + delta;
view.status_change("move")
// 新增墓地位置判断,如果已经在墓地则不再移动
if (view.node.position.x === -1000 || view.node.position.x === 1000) {
return;
}
// 限制移动范围
if (this.validatePosition(newX, move)) {
view.node.setPosition(newX, view.node.position.y, 0);
@@ -45,7 +49,7 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU
else{
view.status_change("idle")
}
this.checkEnemiesInBase(e)
// console.log(`[${view.hero_name}] 类型:${view.type} 是否停止:${shouldStop} 方向:${move.direction} 位置:${view.node.position.x.toFixed(1)}`);
}
@@ -58,8 +62,22 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU
newX >= move.targetX;
}
/** 检测是否在墓地 */
private checkInGrave(entity: ecs.Entity): boolean {
const view = entity.get(HeroViewComp);
return view.node.position.x === -1000 || view.node.position.x === 1000;
}
/**驾车敌人是否进入我放基地 */
private checkEnemiesInBase(entity: ecs.Entity) {
const view = entity.get(HeroViewComp);
if(view.fac==FacSet.MON){
if(view.atk_heart) return
if(view.node.position.x <= FightSet.HEARTPOS){
oops.message.dispatchEvent(GameEvent.LifeChange,-1)
view.atk_heart=true
}
}
}
/** 检测攻击范围内敌人 */
private checkEnemiesInRange(entity: ecs.Entity, range: number): boolean {
const currentPos = entity.get(HeroViewComp).node.position;