fix: 修复怪物技能、朝向和飘字显示问题
1. 修正技能节点缩放逻辑,确保镜像显示正确 2. 修复怪物反向移动时的朝向错误 3. 调整伤害飘字的Y轴偏移,优化显示位置 4. 更新怪物配置的技能ID,修正技能绑定错误
This commit is contained in:
@@ -103,7 +103,10 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
const dirForAngle = new Vec3();
|
||||
Vec3.subtract(dirForAngle, adjustedTargetPos, adjustedStartPos);
|
||||
if (dirForAngle.length() > 0.01) {
|
||||
const angle = Math.atan2(dirForAngle.y, dirForAngle.x) * (180 / Math.PI);
|
||||
let angle = Math.atan2(dirForAngle.y, dirForAngle.x) * (180 / Math.PI);
|
||||
if (moveComp.scale < 0) {
|
||||
angle += 180;
|
||||
}
|
||||
node.angle = angle;
|
||||
}
|
||||
break;
|
||||
@@ -209,7 +212,10 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
|
||||
Vec3.subtract(direction, nextPos, moveComp.currentPos);
|
||||
|
||||
if (direction.length() > 0.01) {
|
||||
const angle = Math.atan2(direction.y, direction.x) * (180 / Math.PI);
|
||||
let angle = Math.atan2(direction.y, direction.x) * (180 / Math.PI);
|
||||
if (moveComp.scale < 0) {
|
||||
angle += 180;
|
||||
}
|
||||
node.angle = angle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ export class Skill extends ecs.Entity {
|
||||
node.active = true;
|
||||
// 设置节点属性
|
||||
let face=caster.node.scale.x < 0 ? -1 : 1
|
||||
node.setScale(v3(node.scale.x*face,node.scale.y,1))
|
||||
node.setScale(v3(Math.abs(node.scale.x)*face,node.scale.y,1))
|
||||
// 初始视图
|
||||
const SView = node.getComponent(SkillView);
|
||||
if (!SView) {
|
||||
|
||||
@@ -71,8 +71,8 @@ export class TooltipCom extends CCComp {
|
||||
// 设置极高的渲染层级,防止被怪物遮挡
|
||||
const topSiblingIndex = 9999;
|
||||
|
||||
// 临时变量,存储当前Y坐标,方便统一处理
|
||||
let currentY = this.node.position.y;
|
||||
// 临时变量,存储当前Y坐标,方便统一处理。增加60的Y轴基础偏移,防止伤害飘字等遮挡血条
|
||||
let currentY = this.node.position.y + 30;
|
||||
|
||||
switch (this.stype) {
|
||||
case TooltipTypes.life: // 普通伤害
|
||||
@@ -82,11 +82,13 @@ export class TooltipCom extends CCComp {
|
||||
scaleMax = 1.5;
|
||||
break;
|
||||
case TooltipTypes.health: // 治疗
|
||||
this.node.setPosition(v3(this.node.position.x + offsetX, currentY));
|
||||
this.node.setSiblingIndex(topSiblingIndex);
|
||||
this.setupLabel("add_life", "hp", this.value);
|
||||
isHeal = true;
|
||||
break;
|
||||
case TooltipTypes.addmp: // 回蓝
|
||||
this.node.setPosition(v3(this.node.position.x + offsetX, currentY));
|
||||
this.node.setSiblingIndex(topSiblingIndex);
|
||||
this.setupLabel("add_mp", "mp", this.value);
|
||||
isHeal = true;
|
||||
@@ -107,25 +109,26 @@ export class TooltipCom extends CCComp {
|
||||
break;
|
||||
case TooltipTypes.uskill:
|
||||
this.setupLabel("uskill", "name", this.value);
|
||||
this.node.setPosition(v3(this.node.position.x, this.node.position.y + 30));
|
||||
this.node.setPosition(v3(this.node.position.x, currentY + 30));
|
||||
this.node.setSiblingIndex(topSiblingIndex);
|
||||
break;
|
||||
case TooltipTypes.lvup:
|
||||
this.node.getChildByName("lvup").active = true;
|
||||
this.node.setPosition(v3(this.node.position.x, this.node.position.y - 30));
|
||||
this.node.setPosition(v3(this.node.position.x, currentY - 30));
|
||||
this.node.setSiblingIndex(topSiblingIndex);
|
||||
break;
|
||||
case TooltipTypes.apup:
|
||||
this.setupLabel("apup", "num", "+" + this.value);
|
||||
this.node.setPosition(v3(this.node.position.x, this.node.position.y - 60));
|
||||
this.node.setPosition(v3(this.node.position.x, currentY - 60));
|
||||
this.node.setSiblingIndex(topSiblingIndex);
|
||||
break;
|
||||
case TooltipTypes.hpup:
|
||||
this.setupLabel("hpup", "num", "+" + this.value);
|
||||
this.node.setPosition(v3(this.node.position.x, this.node.position.y - 60));
|
||||
this.node.setPosition(v3(this.node.position.x, currentY - 60));
|
||||
this.node.setSiblingIndex(topSiblingIndex);
|
||||
break;
|
||||
case TooltipTypes.shield:
|
||||
this.node.setPosition(v3(this.node.position.x + offsetX, currentY));
|
||||
this.node.setSiblingIndex(topSiblingIndex);
|
||||
this.setupLabel("add_life", "hp", this.value);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user