refactor: 整理技能与战斗相关的配置与逻辑
1. 新增技能飞行距离配置项,支持自定义直线技能飞行距离 2. 调整英雄后退击退范围从30改为20 3. 重构击退逻辑,统一敌我双方的边界钳制处理 4. 优化Boss数值配置,固定基础面板为初始英雄2倍强度 5. 修正技能6006的动画资源引用为atk1 6. 调整近战英雄默认停火距离从80改为60 7. 更新注释文档与配置注释,优化代码可读性
This commit is contained in:
@@ -74,6 +74,9 @@ export class SMoveDataComp extends ecs.Comp {
|
||||
|
||||
/** 是否自动销毁(到达目标后) */
|
||||
autoDestroy: boolean = true;
|
||||
|
||||
/** 直线飞行距离(仅 runType=linear 生效,<=0 时延长终点飞出屏幕) */
|
||||
distance: number = 0;
|
||||
|
||||
reset() {
|
||||
this.startPos.set(0, 0, 0);
|
||||
@@ -98,6 +101,7 @@ export class SMoveDataComp extends ecs.Comp {
|
||||
this.startTime = 0;
|
||||
this.totalTime = 0;
|
||||
this.autoDestroy = true;
|
||||
this.distance = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,21 +83,36 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
const direction = new Vec3();
|
||||
Vec3.subtract(direction, originTargetPos, adjustedStartPos);
|
||||
|
||||
// 延长终止点,统一消亡点的x坐标为 +-500
|
||||
const targetX = moveComp.scale > 0 ? 500 : -500;
|
||||
let targetY = originTargetPos.y;
|
||||
let adjustedTargetPos: Vec3;
|
||||
if (moveComp.distance > 0) {
|
||||
// 距离模式:沿起始指向目标的方向飞行固定距离
|
||||
if (direction.length() < 0.01) {
|
||||
// 起终点重合时退化为按朝向水平飞行
|
||||
direction.set(moveComp.scale > 0 ? 1 : -1, 0, 0);
|
||||
}
|
||||
direction.normalize();
|
||||
adjustedTargetPos = v3(
|
||||
adjustedStartPos.x + direction.x * moveComp.distance,
|
||||
adjustedStartPos.y + direction.y * moveComp.distance,
|
||||
originTargetPos.z
|
||||
);
|
||||
} else {
|
||||
// 延长终止点,统一消亡点的x坐标为 +-500
|
||||
const targetX = moveComp.scale > 0 ? 500 : -500;
|
||||
let targetY = originTargetPos.y;
|
||||
|
||||
if (Math.abs(direction.x) > 0.01) {
|
||||
const slope = direction.y / direction.x;
|
||||
targetY = adjustedStartPos.y + slope * (targetX - adjustedStartPos.x);
|
||||
if (Math.abs(direction.x) > 0.01) {
|
||||
const slope = direction.y / direction.x;
|
||||
targetY = adjustedStartPos.y + slope * (targetX - adjustedStartPos.x);
|
||||
}
|
||||
|
||||
adjustedTargetPos = v3(
|
||||
targetX,
|
||||
targetY,
|
||||
originTargetPos.z
|
||||
);
|
||||
}
|
||||
|
||||
const adjustedTargetPos = v3(
|
||||
targetX,
|
||||
targetY,
|
||||
originTargetPos.z
|
||||
);
|
||||
|
||||
moveComp.startPos.set(adjustedStartPos);
|
||||
moveComp.targetPos.set(adjustedTargetPos);
|
||||
node.setPosition(adjustedStartPos);
|
||||
|
||||
@@ -184,6 +184,7 @@ export class Skill extends ecs.Entity {
|
||||
// 从SkillView获取移动参数,位置初始化由SMoveSystem统一处理
|
||||
sMoveCom.atk_x = SView.atk_x;
|
||||
sMoveCom.atk_y = SView.atk_y;
|
||||
sMoveCom.distance = SView.distance;
|
||||
|
||||
if (SView.endType === EType.timeEnd) {
|
||||
let sTimeCom = this.get(StimeDataComp);
|
||||
|
||||
@@ -38,6 +38,10 @@ export class SkillView extends CCComp {
|
||||
@property({ type: CCFloat, slide: true, range: [0, 30, 0.1], tooltip: "timeEnd 持续时间(秒)" })
|
||||
time: number = 0;
|
||||
|
||||
/** 直线飞行距离(像素),仅 runType=linear 时生效(由 prefab 配置,<=0 时保持默认飞出屏幕的行为) */
|
||||
@property({ type: CCFloat, slide: true, range: [0, 2000, 10], tooltip: "直线飞行距离(仅 linear 生效)" })
|
||||
distance: number = 0;
|
||||
|
||||
private debugMode: boolean = false;
|
||||
|
||||
anim: Animation = null;
|
||||
|
||||
Reference in New Issue
Block a user