2 Commits

Author SHA1 Message Date
panw
8fd479c243 chore(hero prefab): 更新多个英雄预制体配置
1. 调整mb5预制体的位置参数
2. 移除mb6预制体的默认动画剪辑并设为null
3. 为mb3预制体新增动画组件并更新相关id引用
2026-05-21 14:50:28 +08:00
panw
bb47a7a318 refactor(hero/map): 重命名MissionHeroCompComp为MissionHeroComp
修改所有引用该组件的文件,统一组件命名,包括导入语句、类定义、静态属性调用以及相关注释,未变更原有业务逻辑。
2026-05-21 14:46:48 +08:00
7 changed files with 133 additions and 91 deletions

View File

@@ -25,20 +25,17 @@
"__id__": 11 "__id__": 11
}, },
{ {
"__id__": 21 "__id__": 23
}, },
{ {
"__id__": 33 "__id__": 35
}, },
{ {
"__id__": 44 "__id__": 46
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 59
},
{ {
"__id__": 61 "__id__": 61
}, },
@@ -53,10 +50,13 @@
}, },
{ {
"__id__": 69 "__id__": 69
},
{
"__id__": 71
} }
], ],
"_prefab": { "_prefab": {
"__id__": 71 "__id__": 73
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -239,10 +239,13 @@
}, },
{ {
"__id__": 18 "__id__": 18
},
{
"__id__": 20
} }
], ],
"_prefab": { "_prefab": {
"__id__": 20 "__id__": 22
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -408,6 +411,48 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "f9iLivg4dHhJksWCjvY9/w" "fileId": "f9iLivg4dHhJksWCjvY9/w"
}, },
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 11
},
"_enabled": true,
"__prefab": {
"__id__": 21
},
"playOnLoad": false,
"_clips": [
{
"__uuid__": "ba8a70c9-3d3d-4aad-b893-126a39a2ccc6",
"__expectedType__": "cc.AnimationClip"
},
{
"__uuid__": "74e64fa3-dd3d-4677-8962-84b22e6ca302",
"__expectedType__": "cc.AnimationClip"
},
{
"__uuid__": "60708659-fa1c-45df-bdda-ff3978250703",
"__expectedType__": "cc.AnimationClip"
},
{
"__uuid__": "d3f64d75-ab93-4ac6-8f1e-46a158cd2564",
"__expectedType__": "cc.AnimationClip"
},
{
"__uuid__": "44f6b032-b834-4ea3-bb9b-f11b087d540e",
"__expectedType__": "cc.AnimationClip"
}
],
"_defaultClip": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "b66w8cpJtNKLOQU7AfAxR/"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
@@ -428,14 +473,14 @@
"__id__": 1 "__id__": 1
}, },
"_prefab": { "_prefab": {
"__id__": 22 "__id__": 24
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 21 "__id__": 23
}, },
"asset": { "asset": {
"__uuid__": "e1b8a315-ece3-41a2-941e-a66861753f1b", "__uuid__": "e1b8a315-ece3-41a2-941e-a66861753f1b",
@@ -443,7 +488,7 @@
}, },
"fileId": "c46/YsCPVOJYA4mWEpNYRx", "fileId": "c46/YsCPVOJYA4mWEpNYRx",
"instance": { "instance": {
"__id__": 23 "__id__": 25
}, },
"targetOverrides": null "targetOverrides": null
}, },
@@ -456,15 +501,9 @@
"mountedChildren": [], "mountedChildren": [],
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{
"__id__": 24
},
{ {
"__id__": 26 "__id__": 26
}, },
{
"__id__": 27
},
{ {
"__id__": 28 "__id__": 28
}, },
@@ -474,8 +513,14 @@
{ {
"__id__": 30 "__id__": 30
}, },
{
"__id__": 31
},
{ {
"__id__": 32 "__id__": 32
},
{
"__id__": 34
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -483,7 +528,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 25 "__id__": 27
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -499,7 +544,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 25 "__id__": 27
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -514,7 +559,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 25 "__id__": 27
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -530,7 +575,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 25 "__id__": 27
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -545,7 +590,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 25 "__id__": 27
}, },
"propertyPath": [ "propertyPath": [
"_active" "_active"
@@ -555,7 +600,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 31 "__id__": 33
}, },
"propertyPath": [ "propertyPath": [
"_contentSize" "_contentSize"
@@ -575,7 +620,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 25 "__id__": 27
}, },
"propertyPath": [ "propertyPath": [
"_lscale" "_lscale"
@@ -594,14 +639,14 @@
"__id__": 1 "__id__": 1
}, },
"_prefab": { "_prefab": {
"__id__": 34 "__id__": 36
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 33 "__id__": 35
}, },
"asset": { "asset": {
"__uuid__": "50c3d5e4-49f8-4bd7-a15b-cda359a0ae5c", "__uuid__": "50c3d5e4-49f8-4bd7-a15b-cda359a0ae5c",
@@ -609,7 +654,7 @@
}, },
"fileId": "5fqU0L3/FOhKaco5UkHuWT", "fileId": "5fqU0L3/FOhKaco5UkHuWT",
"instance": { "instance": {
"__id__": 35 "__id__": 37
}, },
"targetOverrides": null "targetOverrides": null
}, },
@@ -622,23 +667,23 @@
"mountedChildren": [], "mountedChildren": [],
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{
"__id__": 36
},
{ {
"__id__": 38 "__id__": 38
}, },
{
"__id__": 39
},
{ {
"__id__": 40 "__id__": 40
}, },
{ {
"__id__": 41 "__id__": 41
}, },
{
"__id__": 42
},
{ {
"__id__": 43 "__id__": 43
},
{
"__id__": 45
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -646,7 +691,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 37 "__id__": 39
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -662,7 +707,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 37 "__id__": 39
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -677,7 +722,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 37 "__id__": 39
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -693,7 +738,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 37 "__id__": 39
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -708,7 +753,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 42 "__id__": 44
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -729,7 +774,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 37 "__id__": 39
}, },
"propertyPath": [ "propertyPath": [
"_lscale" "_lscale"
@@ -748,14 +793,14 @@
"__id__": 1 "__id__": 1
}, },
"_prefab": { "_prefab": {
"__id__": 45 "__id__": 47
}, },
"__editorExtras__": {} "__editorExtras__": {}
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 44 "__id__": 46
}, },
"asset": { "asset": {
"__uuid__": "02e38f62-860e-4bb9-86d9-a59f073e2881", "__uuid__": "02e38f62-860e-4bb9-86d9-a59f073e2881",
@@ -763,7 +808,7 @@
}, },
"fileId": "54R/aYBglLI4Jn5pm++Jx8", "fileId": "54R/aYBglLI4Jn5pm++Jx8",
"instance": { "instance": {
"__id__": 46 "__id__": 48
}, },
"targetOverrides": null "targetOverrides": null
}, },
@@ -776,15 +821,9 @@
"mountedChildren": [], "mountedChildren": [],
"mountedComponents": [], "mountedComponents": [],
"propertyOverrides": [ "propertyOverrides": [
{
"__id__": 47
},
{ {
"__id__": 49 "__id__": 49
}, },
{
"__id__": 50
},
{ {
"__id__": 51 "__id__": 51
}, },
@@ -794,11 +833,17 @@
{ {
"__id__": 53 "__id__": 53
}, },
{
"__id__": 54
},
{ {
"__id__": 55 "__id__": 55
}, },
{ {
"__id__": 57 "__id__": 57
},
{
"__id__": 59
} }
], ],
"removedComponents": [] "removedComponents": []
@@ -806,7 +851,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 48 "__id__": 50
}, },
"propertyPath": [ "propertyPath": [
"_name" "_name"
@@ -822,7 +867,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 48 "__id__": 50
}, },
"propertyPath": [ "propertyPath": [
"_lpos" "_lpos"
@@ -837,7 +882,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 48 "__id__": 50
}, },
"propertyPath": [ "propertyPath": [
"_lrot" "_lrot"
@@ -853,7 +898,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 48 "__id__": 50
}, },
"propertyPath": [ "propertyPath": [
"_euler" "_euler"
@@ -868,7 +913,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 48 "__id__": 50
}, },
"propertyPath": [ "propertyPath": [
"_lscale" "_lscale"
@@ -883,7 +928,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 54 "__id__": 56
}, },
"propertyPath": [ "propertyPath": [
"_color" "_color"
@@ -906,7 +951,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 56 "__id__": 58
}, },
"propertyPath": [ "propertyPath": [
"_color" "_color"
@@ -929,7 +974,7 @@
{ {
"__type__": "CCPropertyOverrideInfo", "__type__": "CCPropertyOverrideInfo",
"targetInfo": { "targetInfo": {
"__id__": 58 "__id__": 60
}, },
"propertyPath": [ "propertyPath": [
"_active" "_active"
@@ -953,7 +998,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 60 "__id__": 62
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -981,7 +1026,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 62 "__id__": 64
}, },
"anm": { "anm": {
"__id__": 14 "__id__": 14
@@ -1002,7 +1047,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 64 "__id__": 66
}, },
"debugMode": false, "debugMode": false,
"_id": "" "_id": ""
@@ -1021,7 +1066,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 66 "__id__": 68
}, },
"enabledContactListener": true, "enabledContactListener": true,
"bullet": false, "bullet": false,
@@ -1055,7 +1100,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 68 "__id__": 70
}, },
"tag": 0, "tag": 0,
"_group": 4, "_group": 4,
@@ -1089,7 +1134,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 70 "__id__": 72
}, },
"playOnLoad": false, "playOnLoad": false,
"_clips": [], "_clips": [],
@@ -1113,13 +1158,13 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": [ "nestedPrefabInstanceRoots": [
{ {
"__id__": 44 "__id__": 46
}, },
{ {
"__id__": 33 "__id__": 35
}, },
{ {
"__id__": 21 "__id__": 23
}, },
{ {
"__id__": 2 "__id__": 2

View File

@@ -212,8 +212,8 @@
], ],
"value": { "value": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0.7, "x": 0.26,
"y": 1.7, "y": 0.7,
"z": 1 "z": 1
} }
}, },

View File

@@ -446,10 +446,7 @@
"__expectedType__": "cc.AnimationClip" "__expectedType__": "cc.AnimationClip"
} }
], ],
"_defaultClip": { "_defaultClip": null,
"__uuid__": "55ecc0d8-4e5d-4d8c-96df-f618f2ee6bc5",
"__expectedType__": "cc.AnimationClip"
},
"_id": "" "_id": ""
}, },
{ {

View File

@@ -46,7 +46,7 @@ interface MoveFacConfig {
retreatBackX: number; retreatBackX: number;
} }
import { MissionHeroCompComp } from "../map/MissionHeroComp"; import { MissionHeroComp } from "../map/MissionHeroComp";
@ecs.register('MoveSystem') @ecs.register('MoveSystem')
export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate { export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
@@ -253,7 +253,7 @@ export class MoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate
// 优先中前(1) -> 上前(0) -> 下前(2) -> 中后(4) -> 上后(3) -> 下后(5) // 优先中前(1) -> 上前(0) -> 下前(2) -> 中后(4) -> 上后(3) -> 下后(5)
const slotPriority = [1, 0, 2, 4, 3, 5]; const slotPriority = [1, 0, 2, 4, 3, 5];
const posIndex = slotPriority[slotIndex % 6]; const posIndex = slotPriority[slotIndex % 6];
const pos = MissionHeroCompComp.HERO_POSITIONS[posIndex]; const pos = MissionHeroComp.HERO_POSITIONS[posIndex];
return { targetX: pos.x, targetY: pos.y }; return { targetX: pos.x, targetY: pos.y };
} }

View File

@@ -32,7 +32,7 @@ import { GameEvent } from "../common/config/GameEvent";
import { oops } from "db://oops-framework/core/Oops"; import { oops } from "db://oops-framework/core/Oops";
import { UIID } from "../common/config/GameUIConfig"; import { UIID } from "../common/config/GameUIConfig";
import { mLogger } from "../common/Logger"; import { mLogger } from "../common/Logger";
import { MissionHeroCompComp } from "./MissionHeroComp"; import { MissionHeroComp } from "./MissionHeroComp";
import { MoveComp } from "../hero/MoveComp"; import { MoveComp } from "../hero/MoveComp";
import { FacSet } from "../common/config/GameSet"; import { FacSet } from "../common/config/GameSet";
import { MissionEconomy } from "./MissionEconomy"; import { MissionEconomy } from "./MissionEconomy";
@@ -107,7 +107,7 @@ export class HInfoComp extends CCComp {
*/ */
refreshByNodeIndex() { refreshByNodeIndex() {
if (this.node_index < 1 || this.node_index > 6) return; if (this.node_index < 1 || this.node_index > 6) return;
const targetPos = MissionHeroCompComp.HERO_POSITIONS[this.node_index - 1]; const targetPos = MissionHeroComp.HERO_POSITIONS[this.node_index - 1];
let foundModel: HeroAttrsComp | null = null; let foundModel: HeroAttrsComp | null = null;
let foundEid: number = 0; let foundEid: number = 0;

View File

@@ -29,7 +29,7 @@
* - HInfoComp —— 英雄信息面板 * - HInfoComp —— 英雄信息面板
* - CardSet 模块 —— 卡池配置、抽卡规则、特殊卡数据 * - CardSet 模块 —— 卡池配置、抽卡规则、特殊卡数据
* - HeroAttrsComp —— 英雄属性(合成校验 / 升级) * - HeroAttrsComp —— 英雄属性(合成校验 / 升级)
* - MissionHeroCompComp —— 获取合成规则needCount / maxLv * - MissionHeroComp —— 获取合成规则needCount / maxLv
* - smc.vmdata.mission_data —— 局内数据coin / hero_num / hero_max_num * - smc.vmdata.mission_data —— 局内数据coin / hero_num / hero_max_num
*/ */
import { mLogger } from "../common/Logger"; import { mLogger } from "../common/Logger";
@@ -47,7 +47,7 @@ import { HeroInfo, HType } from "../common/config/heroSet";
import { HeroViewComp } from "../hero/HeroViewComp"; import { HeroViewComp } from "../hero/HeroViewComp";
import { FacSet, FightSet } from "../common/config/GameSet"; import { FacSet, FightSet } from "../common/config/GameSet";
import { MoveComp } from "../hero/MoveComp"; import { MoveComp } from "../hero/MoveComp";
import { MissionHeroCompComp } from "./MissionHeroComp"; import { MissionHeroComp } from "./MissionHeroComp";
import { TalentType } from "../common/config/TalentSet"; import { TalentType } from "../common/config/TalentSet";
import { MissionEconomy } from "./MissionEconomy"; import { MissionEconomy } from "./MissionEconomy";
@@ -479,15 +479,15 @@ export class MissionCardComp extends CCComp {
} }
/** /**
* 从 MissionHeroCompComp 实时读取合成规则。 * 从 MissionHeroComp 实时读取合成规则。
* 通过 ECS 查询获取,避免硬编码与 MissionHeroComp 不一致。 * 通过 ECS 查询获取,避免硬编码与 MissionHeroComp 不一致。
* @returns { needCount: 合成所需数量, maxLv: 最大合成等级 } * @returns { needCount: 合成所需数量, maxLv: 最大合成等级 }
*/ */
private getMergeRule(): { needCount: number, maxLv: number } { private getMergeRule(): { needCount: number, maxLv: number } {
let needCount = FightSet.MERGE_NEED ? FightSet.MERGE_NEED:2 let needCount = FightSet.MERGE_NEED ? FightSet.MERGE_NEED:2
let maxLv = Math.max(1, Math.floor(FightSet.MERGE_MAX ?? 3)); let maxLv = Math.max(1, Math.floor(FightSet.MERGE_MAX ?? 3));
ecs.query(ecs.allOf(MissionHeroCompComp)).forEach((entity: ecs.Entity) => { ecs.query(ecs.allOf(MissionHeroComp)).forEach((entity: ecs.Entity) => {
const comp = entity.get(MissionHeroCompComp); const comp = entity.get(MissionHeroComp);
if (!comp) return; if (!comp) return;
needCount = comp.merge_need_count === 2 ? 2 : 3; needCount = comp.merge_need_count === 2 ? 2 : 3;
maxLv = Math.max(1, Math.floor(comp.merge_max_lv ?? 3)); maxLv = Math.max(1, Math.floor(comp.merge_max_lv ?? 3));

View File

@@ -43,14 +43,14 @@ import { MoveComp } from "../hero/MoveComp";
const { ccclass } = _decorator; const { ccclass } = _decorator;
/** /**
* MissionHeroCompComp —— 英雄召唤与合成管理器 * MissionHeroComp —— 英雄召唤与合成管理器
* *
* 管理英雄的召唤请求队列、出生动画和合成系统。 * 管理英雄的召唤请求队列、出生动画和合成系统。
* 合成支持 2 合 1 或 3 合 1且可链式合成至上限等级。 * 合成支持 2 合 1 或 3 合 1且可链式合成至上限等级。
*/ */
@ccclass('MissionHeroCompComp') @ccclass('MissionHeroComp')
@ecs.register('MissionHeroComp', false) @ecs.register('MissionHeroComp', false)
export class MissionHeroCompComp extends CCComp { export class MissionHeroComp extends CCComp {
// ======================== 常量 ======================== // ======================== 常量 ========================
/** 硬编码的6个英雄占位点 */ /** 硬编码的6个英雄占位点 */
@@ -135,7 +135,7 @@ export class MissionHeroCompComp extends CCComp {
const landingPos = this.pickPositionForHero([hero.eid]); const landingPos = this.pickPositionForHero([hero.eid]);
// 不再直接设置位置,而是播放下落入场动画 // 不再直接设置位置,而是播放下落入场动画
// 计算出出生点(空中) // 计算出出生点(空中)
const spawnPos: Vec3 = v3(landingPos.x, landingPos.y + MissionHeroCompComp.HERO_DROP_HEIGHT, 0); const spawnPos: Vec3 = v3(landingPos.x, landingPos.y + MissionHeroComp.HERO_DROP_HEIGHT, 0);
view.node.setPosition(spawnPos); view.node.setPosition(spawnPos);
hero.playDropAnim(spawnPos, landingPos.y); hero.playDropAnim(spawnPos, landingPos.y);
} }
@@ -181,8 +181,8 @@ export class MissionHeroCompComp extends CCComp {
for (const h of heroes) { for (const h of heroes) {
const move = h.get(MoveComp); // MoveComp 记录了英雄当前的目标位置 const move = h.get(MoveComp); // MoveComp 记录了英雄当前的目标位置
if (move) { if (move) {
for (let i = 0; i < MissionHeroCompComp.HERO_POSITIONS.length; i++) { for (let i = 0; i < MissionHeroComp.HERO_POSITIONS.length; i++) {
const pos = MissionHeroCompComp.HERO_POSITIONS[i]; const pos = MissionHeroComp.HERO_POSITIONS[i];
if (Math.abs(move.targetX - pos.x) < 2 && Math.abs(move.baseY - pos.y) < 2) { if (Math.abs(move.targetX - pos.x) < 2 && Math.abs(move.baseY - pos.y) < 2) {
occupied.add(i); occupied.add(i);
break; break;
@@ -195,12 +195,12 @@ export class MissionHeroCompComp extends CCComp {
const slotPriority = [1, 0, 2, 4, 3, 5]; const slotPriority = [1, 0, 2, 4, 3, 5];
for (const idx of slotPriority) { for (const idx of slotPriority) {
if (!occupied.has(idx)) { if (!occupied.has(idx)) {
return MissionHeroCompComp.HERO_POSITIONS[idx]; return MissionHeroComp.HERO_POSITIONS[idx];
} }
} }
// 溢出:默认中前 // 溢出:默认中前
return MissionHeroCompComp.HERO_POSITIONS[1]; return MissionHeroComp.HERO_POSITIONS[1];
} }
/** /**
@@ -218,7 +218,7 @@ export class MissionHeroCompComp extends CCComp {
let hero = ecs.getEntity<Hero>(Hero); let hero = ecs.getEntity<Hero>(Hero);
let scale = 1 let scale = 1
const landingPos = this.pickPositionForHero(); const landingPos = this.pickPositionForHero();
let spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroCompComp.HERO_DROP_HEIGHT, 0); let spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroComp.HERO_DROP_HEIGHT, 0);
hero.load(spawnPos,scale,uuid,landingPos.y,hero_lv,pool_lv); hero.load(spawnPos,scale,uuid,landingPos.y,hero_lv,pool_lv);
// 召唤完成后,派发事件以更新英雄面板 // 召唤完成后,派发事件以更新英雄面板
@@ -252,7 +252,7 @@ export class MissionHeroCompComp extends CCComp {
let scale = 1 let scale = 1
const landingPos = targetPos || this.pickPositionForHero(); const landingPos = targetPos || this.pickPositionForHero();
let spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroCompComp.HERO_DROP_HEIGHT, 0); let spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroComp.HERO_DROP_HEIGHT, 0);
hero.load(spawnPos,scale,uuid,landingPos.y,hero_lv,pool_lv); hero.load(spawnPos,scale,uuid,landingPos.y,hero_lv,pool_lv);
// 召唤完成后,派发事件以更新英雄面板 // 召唤完成后,派发事件以更新英雄面板
@@ -501,7 +501,7 @@ export class MissionHeroCompComp extends CCComp {
// 计算目标出生点(提前排除素材英雄所占的位置) // 计算目标出生点(提前排除素材英雄所占的位置)
const landingPos = this.pickPositionForHero(mergeEids); const landingPos = this.pickPositionForHero(mergeEids);
const spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroCompComp.HERO_DROP_HEIGHT, 0); const spawnPos:Vec3 = v3(landingPos.x, landingPos.y + MissionHeroComp.HERO_DROP_HEIGHT, 0);
// 汇聚 → 特效 → 生成 // 汇聚 → 特效 → 生成
await this.mergeDestroyAtBirth(mergeHeroes, spawnPos); await this.mergeDestroyAtBirth(mergeHeroes, spawnPos);