技能碰撞改回物理碰撞
This commit is contained in:
@@ -28,7 +28,7 @@ export enum BoxSet {
|
||||
MONSTER_START = 360,
|
||||
END_POINT = 360,
|
||||
//游戏地平线
|
||||
GAME_LINE = 10,
|
||||
GAME_LINE = 130,
|
||||
CSKILL_X = 320,
|
||||
CSKILL_Y = 400,
|
||||
//攻击距离
|
||||
|
||||
@@ -19,5 +19,6 @@ export enum GameEvent {
|
||||
UseCard = "UseCard",
|
||||
UserHeroCard = "UserHeroCard",
|
||||
UserSkillCard = "UserSkillCard",
|
||||
CallHero = "CallHero",
|
||||
|
||||
}
|
||||
@@ -13,12 +13,12 @@ export const BossList = {
|
||||
}
|
||||
export const MissionNum = 3 //对应关卡数MissionSet 的索引
|
||||
export const MissionSet = [
|
||||
[5201,5202,5203,5204,5205,5206,5207,5208,5209,5210,5211,5212],
|
||||
[5201,5202,5203,5204,5205,5206,5210,5211,5212],
|
||||
[5213,5214,5215],
|
||||
[5201],
|
||||
]
|
||||
export const Missions = [
|
||||
[5201,5202,5203,5204,5205,5206,5207,5208,5209,5210,5211,5212,5219,5220,5221],
|
||||
[5201,5202,5203,5204,5205,5206,5210,5211,5212,5219,5220,5221],
|
||||
[5213,5214,5215,5216,5217,5218],
|
||||
[5225,5226,5227],
|
||||
]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { v3 } from "cc"
|
||||
|
||||
/**
|
||||
* kind :1:烈焰 2:寒冰 3:自然 4:暗影 5:神圣
|
||||
**/
|
||||
@@ -30,52 +32,56 @@ export enum HeroFac {
|
||||
enemy = 1,
|
||||
}
|
||||
export const HeroList = [5001,5002,5003,5004,5005,5006,5007,5008,5009,5010,5011]
|
||||
export const MonList = [5201,5202,5203,5204,5205,5206,5207,5208,5209,5210,5211,5212,5213,5214,5215,5216,5217,5218,5219,5220,5221,5222,5223,5224,5225,5226,5227]
|
||||
export const MonList = [5201,5202,5203,5204,5205,5206,5210,5211,5212,5213,5214,5215,5216,5217,5218,5219,5220,5221,5222,5223,5224,5225,5226,5227]
|
||||
export const HeroSet = {
|
||||
Start_x:[-200,-260,-320],
|
||||
Start_y:[70,0,-70]
|
||||
}
|
||||
export const HeroPos={
|
||||
0:{pos:v3(-140,130,0)},
|
||||
1:{pos:v3(-220,130,0)},
|
||||
2:{pos:v3(-300,130,0)},
|
||||
}
|
||||
export const MonSet = {
|
||||
Start_x:[200,260,320],
|
||||
Start_y:[70,0,-70]
|
||||
0:{pos:v3(320,220,0)},
|
||||
1:{pos:v3(320,150,0)},
|
||||
2:{pos:v3(320,80,0)},
|
||||
3:{pos:v3(320,10,0)},
|
||||
}
|
||||
export const HeroInfo = {
|
||||
5001:{uuid:5001,name:"神圣守护",path:"k2", quality:3,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5002:{uuid:5002,name:"幻影剑豪",path:"k1", quality:3,kind:2,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5003:{uuid:5003,name:"战争领主",path:"k5", quality:3,kind:2,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5004:{uuid:5004,name:"混沌法师",path:"zh1", quality:3,kind:2,type:2,hp:200,ap:10,dis:500,a_cd:1.5,speed:50,skills:[6003],tals:"说明"},
|
||||
5005:{uuid:5005,name:"火焰法师",path:"zh2", quality:3,kind:2,type:2,hp:200,ap:15,dis:500,a_cd:1.5,speed:50,skills:[6003],tals:"说明"},
|
||||
5006:{uuid:5006,name:"风暴精灵",path:"m4", quality:3,kind:2,type:2,hp:200,ap:15,dis:500,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
||||
5007:{uuid:5007,name:"生命圣者",path:"d1", quality:3,kind:2,type:2,hp:200,ap:10,dis:500,a_cd:1.5,speed:50,skills:[6003],tals:"说明"},
|
||||
5008:{uuid:5008,name:"战争祭祀",path:"d2", quality:3,kind:2,type:2,hp:200,ap:10,dis:500,a_cd:1.5,speed:50,skills:[6003],tals:"说明"},
|
||||
5009:{uuid:5009,name:"暴风射手",path:"a5", quality:3,kind:2,type:1,hp:200,ap:15,dis:400,a_cd:1.2,speed:50,skills:[6006],tals:"说明"},
|
||||
5010:{uuid:5010,name:"苍穹射手",path:"a3", quality:3,kind:1,type:1,hp:200,ap:15,dis:400,a_cd:1.2,speed:50,skills:[6006],tals:"说明"},
|
||||
5011:{uuid:5011,name:"幽灵射手",path:"a4", quality:3,kind:2,type:1,hp:200,ap:15,dis:400,a_cd:1.2,speed:50,skills:[6006],tals:"说明"},
|
||||
5201:{uuid:5201,name:"兽人战士",path:"mor1", quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5202:{uuid:5202,name:"兽人刺客",path:"mor2", quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5203:{uuid:5203,name:"兽人护卫",path:"mor3", quality:1,kind:1,type:1,hp:200,ap:15,dis:400,a_cd:1.2,speed:50,skills:[6007],tals:"说明"},
|
||||
5204:{uuid:5204,name:"石卫", path:"mgem1",quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5205:{uuid:5205,name:"土卫", path:"mgem2",quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5206:{uuid:5206,name:"树人", path:"mgem3",quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5207:{uuid:5207,name:"小骷髅", path:"mkl1", quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5208:{uuid:5208,name:"小骷髅", path:"mkl2", quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5209:{uuid:5209,name:"小骷髅", path:"mkl3", quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5210:{uuid:5210,name:"骷髅战士",path:"mkl4", quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5211:{uuid:5211,name:"骷髅战士",path:"mkl5", quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5212:{uuid:5212,name:"骷髅战士",path:"mkl6", quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5213:{uuid:5213,name:"骷髅射手",path:"mkla1",quality:1,kind:1,type:1,hp:200,ap:15,dis:400,a_cd:1.2,speed:50,skills:[6005],tals:"说明"},
|
||||
5214:{uuid:5214,name:"骷髅射手",path:"mkla2",quality:1,kind:1,type:1,hp:200,ap:15,dis:400,a_cd:1.2,speed:50,skills:[6005],tals:"说明"},
|
||||
5215:{uuid:5215,name:"骷髅射手",path:"mkla3",quality:1,kind:1,type:1,hp:200,ap:15,dis:400,a_cd:1.2,speed:50,skills:[6005],tals:"说明"},
|
||||
5216:{uuid:5216,name:"元素1", path:"my1", quality:2,kind:1,type:2,hp:200,ap:15,dis:500,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
||||
5217:{uuid:5217,name:"元素2", path:"my2", quality:2,kind:1,type:2,hp:200,ap:15,dis:500,a_cd:1.5,speed:50,skills:[6002],tals:"说明"},
|
||||
5218:{uuid:5218,name:"元素3", path:"my3", quality:2,kind:1,type:2,hp:200,ap:15,dis:500,a_cd:1.5,speed:50,skills:[6003],tals:"说明"},
|
||||
5219:{uuid:5219,name:"牛头战士",path:"mn1", quality:2,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5220:{uuid:5220,name:"牛头战士",path:"mn2", quality:1,kind:1,type:1,hp:200,ap:15,dis:400,a_cd:1.2,speed:50,skills:[6010],tals:"说明"},
|
||||
5221:{uuid:5221,name:"牛头战士",path:"mn3", quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5222:{uuid:5222,name:"独眼巨人",path:"md1", quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5223:{uuid:5223,name:"独眼巨人",path:"md2", quality:1,kind:1,type:0,hp:200,ap:10,dis:400,a_cd:1,speed:50,skills:[6008],tals:"说明"},
|
||||
5224:{uuid:5224,name:"独眼巨人",path:"md3", quality:1,kind:1,type:1,hp:200,ap:15,dis:400,a_cd:1.2,speed:50,skills:[6005],tals:"说明"},
|
||||
5225:{uuid:5225,name:"精英独眼",path:"md4", quality:3,kind:1,type:2,hp:200,ap:15,dis:500,a_cd:1,speed:50,skills:[6009],tals:"说明"},
|
||||
5226:{uuid:5226,name:"精英牛头",path:"mn4", quality:3,kind:1,type:2,hp:200,ap:15,dis:500,a_cd:1,speed:50,skills:[6010],tals:"说明"},
|
||||
5227:{uuid:5227,name:"精英兽人",path:"mor4", quality:3,kind:1,type:2,hp:200,ap:15,dis:500,a_cd:1,speed:50,skills:[6009],tals:"说明"}
|
||||
5001:{uuid:5001,name:"神圣守护",path:"k2", lv:3,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:700,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5002:{uuid:5002,name:"幻影剑豪",path:"k1", lv:3,kind:2,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:700,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5003:{uuid:5003,name:"战争领主",path:"k5", lv:3,kind:2,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:700,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5004:{uuid:5004,name:"混沌法师",path:"zh1", lv:3,kind:2,type:2,hp:200,ap:10,rate:50,ra_up:0,dis:700,a_cd:1.5,speed:50,skills:[6003],tals:"说明"},
|
||||
5005:{uuid:5005,name:"火焰法师",path:"zh2", lv:3,kind:2,type:2,hp:200,ap:15,rate:50,ra_up:0,dis:700,a_cd:1.5,speed:50,skills:[6003],tals:"说明"},
|
||||
5006:{uuid:5006,name:"风暴精灵",path:"m4", lv:3,kind:2,type:2,hp:200,ap:15,rate:50,ra_up:0,dis:700,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
||||
5007:{uuid:5007,name:"生命圣者",path:"d1", lv:3,kind:2,type:2,hp:200,ap:10,rate:50,ra_up:0,dis:700,a_cd:1.5,speed:50,skills:[6003],tals:"说明"},
|
||||
5008:{uuid:5008,name:"战争祭祀",path:"d2", lv:3,kind:2,type:2,hp:200,ap:10,rate:50,ra_up:0,dis:700,a_cd:1.5,speed:50,skills:[6003],tals:"说明"},
|
||||
5009:{uuid:5009,name:"暴风射手",path:"a5", lv:3,kind:2,type:1,hp:200,ap:15,rate:50,ra_up:0,dis:700,a_cd:1.2,speed:50,skills:[6006],tals:"说明"},
|
||||
5010:{uuid:5010,name:"苍穹射手",path:"a3", lv:3,kind:1,type:1,hp:200,ap:15,rate:50,ra_up:0,dis:700,a_cd:1.2,speed:50,skills:[6006],tals:"说明"},
|
||||
5011:{uuid:5011,name:"幽灵射手",path:"a4", lv:3,kind:2,type:1,hp:200,ap:15,rate:50,ra_up:0,dis:700,a_cd:1.2,speed:50,skills:[6006],tals:"说明"},
|
||||
5201:{uuid:5201,name:"兽人战士",path:"mor1", lv:1,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:80,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5202:{uuid:5202,name:"兽人刺客",path:"mor2", lv:1,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:80,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5203:{uuid:5203,name:"兽人护卫",path:"mor3", lv:1,kind:1,type:1,hp:200,ap:15,rate:50,ra_up:0,dis:80,a_cd:1.2,speed:50,skills:[6007],tals:"说明"},
|
||||
5204:{uuid:5204,name:"石卫", path:"mgem1",lv:1,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:80,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5205:{uuid:5205,name:"土卫", path:"mgem2",lv:1,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:80,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5206:{uuid:5206,name:"树人", path:"mgem3",lv:1,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:80,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5210:{uuid:5210,name:"骷髅战士",path:"mkl4", lv:1,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:80,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5211:{uuid:5211,name:"骷髅战士",path:"mkl5", lv:1,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:80,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5212:{uuid:5212,name:"骷髅战士",path:"mkl6", lv:1,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:80,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5213:{uuid:5213,name:"骷髅射手",path:"mkla1",lv:1,kind:1,type:1,hp:200,ap:15,rate:50,ra_up:0,dis:80,a_cd:1.2,speed:50,skills:[6005],tals:"说明"},
|
||||
5214:{uuid:5214,name:"骷髅射手",path:"mkla2",lv:1,kind:1,type:1,hp:200,ap:15,rate:50,ra_up:0,dis:80,a_cd:1.2,speed:50,skills:[6005],tals:"说明"},
|
||||
5215:{uuid:5215,name:"骷髅射手",path:"mkla3",lv:1,kind:1,type:1,hp:200,ap:15,rate:50,ra_up:0,dis:80,a_cd:1.2,speed:50,skills:[6005],tals:"说明"},
|
||||
5216:{uuid:5216,name:"元素1", path:"my1", lv:2,kind:1,type:2,hp:200,ap:15,rate:50,ra_up:0,dis:200,a_cd:1.5,speed:50,skills:[6001],tals:"说明"},
|
||||
5217:{uuid:5217,name:"元素2", path:"my2", lv:2,kind:1,type:2,hp:200,ap:15,rate:50,ra_up:0,dis:200,a_cd:1.5,speed:50,skills:[6002],tals:"说明"},
|
||||
5218:{uuid:5218,name:"元素3", path:"my3", lv:2,kind:1,type:2,hp:200,ap:15,rate:50,ra_up:0,dis:200,a_cd:1.5,speed:50,skills:[6003],tals:"说明"},
|
||||
5219:{uuid:5219,name:"牛头战士",path:"mn1", lv:2,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:80,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5220:{uuid:5220,name:"牛头战士",path:"mn2", lv:1,kind:1,type:1,hp:200,ap:15,rate:50,ra_up:0,dis:80,a_cd:1.2,speed:50,skills:[6010],tals:"说明"},
|
||||
5221:{uuid:5221,name:"牛头战士",path:"mn3", lv:1,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:80,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5222:{uuid:5222,name:"独眼巨人",path:"md1", lv:1,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:80,a_cd:1,speed:50,skills:[6005],tals:"说明"},
|
||||
5223:{uuid:5223,name:"独眼巨人",path:"md2", lv:1,kind:1,type:0,hp:200,ap:10,rate:50,ra_up:0,dis:80,a_cd:1,speed:50,skills:[6008],tals:"说明"},
|
||||
5224:{uuid:5224,name:"独眼巨人",path:"md3", lv:1,kind:1,type:1,hp:200,ap:15,rate:50,ra_up:0,dis:80,a_cd:1.2,speed:50,skills:[6005],tals:"说明"},
|
||||
5225:{uuid:5225,name:"精英独眼",path:"md4", lv:3,kind:1,type:2,hp:200,ap:15,rate:50,ra_up:0,dis:200,a_cd:1,speed:50,skills:[6009],tals:"说明"},
|
||||
5226:{uuid:5226,name:"精英牛头",path:"mn4", lv:3,kind:1,type:2,hp:200,ap:15,rate:50,ra_up:0,dis:200,a_cd:1,speed:50,skills:[6010],tals:"说明"},
|
||||
5227:{uuid:5227,name:"精英兽人",path:"mor4", lv:3,kind:1,type:2,hp:200,ap:15,rate:50,ra_up:0,dis:200,a_cd:1,speed:50,skills:[6009],tals:"说明"}
|
||||
};
|
||||
@@ -28,7 +28,7 @@ export class BattleMoveSystem extends ecs.ComblockSystem implements ecs.ISystemU
|
||||
this.updateRenderOrder(e);
|
||||
|
||||
// 同步状态
|
||||
if (!shouldStop) {
|
||||
if (!shouldStop&&view.fac==1) {
|
||||
if(view.is_stop||view.is_dead) return //停止移动或者死亡不移动
|
||||
// 计算移动量
|
||||
const delta = (view.speed/3) * this.dt * move.direction;
|
||||
|
||||
@@ -6,7 +6,6 @@ import { HeroModelComp } from "./HeroModelComp";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { Talents } from "../common/config/TalentSet";
|
||||
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
||||
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
||||
/** 角色实体 */
|
||||
@@ -25,12 +24,13 @@ export class Hero extends ecs.Entity {
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
this.remove(HeroViewComp);;
|
||||
this.remove(HeroViewComp);
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
/** 加载角色 */
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,is_call:boolean=false,lv:number=1) {
|
||||
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001,info:any={ap:0,hp:0}) {
|
||||
console.log("英雄加载:",uuid,pos,scale,info)
|
||||
scale = 1
|
||||
let box_group=BoxSet.HERO
|
||||
var path = "game/heros/"+HeroInfo[uuid].path;
|
||||
@@ -39,10 +39,7 @@ export class Hero extends ecs.Entity {
|
||||
var scene = smc.map.MapView.scene;
|
||||
node.parent = scene.entityLayer!.node!
|
||||
node.setPosition(pos)
|
||||
this.hero_init(uuid,node,scale,box_group,is_call,lv)
|
||||
oops.message.dispatchEvent("hero_load",this)
|
||||
}
|
||||
hero_init(uuid:number=1001,node:Node,scale:number=1,box_group=BoxSet.HERO,is_call:boolean=false,lv:number=1){
|
||||
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
let hero= HeroInfo[uuid] // 共用英雄数据
|
||||
hv.scale = scale;
|
||||
@@ -53,25 +50,22 @@ export class Hero extends ecs.Entity {
|
||||
hv.hero_name= hero.name;
|
||||
hv.speed =hv.ospeed = hero.speed;
|
||||
hv.dis = hero.dis;
|
||||
hv.hp= hv.hp_max =hero.hp;
|
||||
hv.ap = hero.ap;
|
||||
hv.hp= hv.hp_max =hero.hp+info.hp;
|
||||
hv.ap = hero.ap+info.ap;
|
||||
hv.cd = hero.a_cd
|
||||
hv.rate=hero.rate
|
||||
hv.r_up=hero.ra_up
|
||||
hv.atk_skill=hero.skills[0]
|
||||
this.add(hv);
|
||||
|
||||
// // 初始化多个技能组件
|
||||
// const skillsComp = this.get(HeroSkillsComp);
|
||||
// // 正确初始化已有技能
|
||||
// hero.skills.forEach(skillId => {
|
||||
// this.addSkill(skillId); // 使用addSkill方法确保初始化
|
||||
// });
|
||||
|
||||
// 初始化移动参数
|
||||
const move = this.get(BattleMoveComp);
|
||||
move.direction = 1; // 向右移动
|
||||
move.targetX = 800; // 右边界
|
||||
move.targetX = 800; // 右边界'
|
||||
|
||||
|
||||
oops.message.dispatchEvent("hero_load",this)
|
||||
}
|
||||
|
||||
|
||||
// 添加技能
|
||||
public addSkill(skillId: number) {
|
||||
const comp = this.get(HeroSkillsComp);
|
||||
|
||||
@@ -10,21 +10,21 @@ export default class HeroAnmComp extends Component{
|
||||
private _hasStop = true;
|
||||
onLoad () {
|
||||
var spine = this.spine = this.getComponent('sp.Skeleton') as sp.Skeleton;
|
||||
this._setMix('Walking', 'Idle');
|
||||
this._setMix('Walking', 'Attacking');
|
||||
this._setMix('Walking', 'Taunt');
|
||||
this._setMix('Idle', 'Attacking');
|
||||
this._setMix('Idle', 'Taunt');
|
||||
this._setMix('Idle', 'Walking');
|
||||
this._setMix('Attacking', 'Idle');
|
||||
this._setMix('Attacking', 'Walking');
|
||||
this._setMix('Taunt', 'Walking');
|
||||
this._setMix('Taunt', 'Idle');
|
||||
// this._setMix('Walking', 'Idle');
|
||||
// this._setMix('Walking', 'Attacking');
|
||||
// this._setMix('Walking', 'Taunt');
|
||||
// this._setMix('Idle', 'Attacking');
|
||||
// this._setMix('Idle', 'Taunt');
|
||||
// this._setMix('Idle', 'Walking');
|
||||
// this._setMix('Attacking', 'Idle');
|
||||
// this._setMix('Attacking', 'Walking');
|
||||
// this._setMix('Taunt', 'Walking');
|
||||
// this._setMix('Taunt', 'Idle');
|
||||
|
||||
spine.setCompleteListener((trackEntry) => {
|
||||
var animationName = trackEntry.animation ? trackEntry.animation.name : "";
|
||||
if (animationName === 'Attacking'||animationName==='Taunt'||animationName==='Hurt') {
|
||||
this.spine!.clearTrack(1);
|
||||
// this.spine!.clearTrack(1);
|
||||
}
|
||||
var loopCount = Math.floor(trackEntry.trackTime / trackEntry.animationEnd);
|
||||
// console.log("[track %s][animation %s] complete: %s", trackEntry.trackIndex, animationName, loopCount);
|
||||
@@ -67,7 +67,7 @@ export default class HeroAnmComp extends Component{
|
||||
// ANIMATIONS
|
||||
|
||||
stop () {
|
||||
this.spine?.clearTrack(0);
|
||||
// this.spine?.clearTrack(0);
|
||||
this._hasStop = true;
|
||||
}
|
||||
|
||||
@@ -92,8 +92,8 @@ export default class HeroAnmComp extends Component{
|
||||
this.spine?.setAnimation(0, 'Idle', true);
|
||||
}
|
||||
|
||||
_setMix (anim1: string, anim2: string) {
|
||||
this.spine?.setMix(anim1, anim2, this.mixTime);
|
||||
this.spine?.setMix(anim2, anim1, this.mixTime);
|
||||
}
|
||||
// _setMix (anim1: string, anim2: string) {
|
||||
// this.spine?.setMix(anim1, anim2, this.mixTime);
|
||||
// this.spine?.setMix(anim2, anim1, this.mixTime);
|
||||
// }
|
||||
}
|
||||
68
assets/script/game/hero/HeroInfoComp.ts
Normal file
68
assets/script/game/hero/HeroInfoComp.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import { _decorator, Label, resources, Sprite, SpriteAtlas } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroModelComp } from "./HeroModelComp";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { HeroInfo, HeroPos, HeroSet } from "../common/config/heroSet";
|
||||
import { MissionComp } from "../map/MissionComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('HeroInfoCompComp')
|
||||
@ecs.register('HeroInfoComp', false)
|
||||
export class HeroInfoCompComp extends CCComp {
|
||||
@property(Number)
|
||||
c_id:number=0
|
||||
@property(Boolean)
|
||||
is_Change:boolean=false
|
||||
|
||||
has_hero:boolean=false
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
// this.on(ModuleEvent.Cmd, this.onHandler, this);
|
||||
this.init()
|
||||
}
|
||||
init(){
|
||||
this.has_hero=false
|
||||
}
|
||||
update(dt: number): void {
|
||||
if(!smc.mission.play) return
|
||||
this.update_info()
|
||||
}
|
||||
update_info(){
|
||||
let heros=ecs.query(ecs.allOf(HeroModelComp))
|
||||
for(let hero of heros){
|
||||
let info=hero.get(HeroViewComp)
|
||||
if(info.node.position.x==HeroPos[this.c_id].pos.x){
|
||||
this.has_hero=true
|
||||
this.node.getChildByName("info").getChildByName("ap").getChildByName("num").getComponent(Label).string=info.ap.toString()
|
||||
this.node.getChildByName("info").getChildByName("hp").getChildByName("num").getComponent(Label).string=info.hp.toString()
|
||||
this.node.getChildByName("name").getComponent(Label).string=HeroInfo[info.hero_uuid].name
|
||||
var icon_path = "game/heros/herois"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("mask").getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(HeroInfo[info.hero_uuid].path);
|
||||
});
|
||||
}
|
||||
}
|
||||
if(this.is_Change){
|
||||
this.node.getChildByName("change").active=this.has_hero
|
||||
this.node.getChildByName("select").active=!this.has_hero
|
||||
}
|
||||
}
|
||||
/** 全局消息逻辑处理 */
|
||||
// private onHandler(event: string, args: any) {
|
||||
// switch (event) {
|
||||
// case ModuleEvent.Cmd:
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "9b14bcef-b9c5-4132-ab96-e089fc1d8545",
|
||||
"uuid": "e8cba331-88b0-4b08-9756-374a422d3c28",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label ,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite, math, clamp, Game, tween, Color, RigidBody, RigidBody2D} from "cc";
|
||||
import { Vec3, _decorator , v3,Collider2D,Contact2DType,Label ,Node,Prefab,instantiate,ProgressBar, Component, Material, Sprite, math, clamp, Game, tween, Color} from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { HeroSpine } from "./HeroSpine";
|
||||
@@ -39,7 +39,6 @@ export class HeroViewComp extends CCComp {
|
||||
atk_range:number = 150;
|
||||
|
||||
box_group:number = BoxSet.HERO;
|
||||
rigid:RigidBody2D=null!;
|
||||
|
||||
|
||||
is_dead:boolean = false; //是否摧毁
|
||||
@@ -47,7 +46,8 @@ export class HeroViewComp extends CCComp {
|
||||
is_atking:boolean = false;
|
||||
is_boss:boolean = false;
|
||||
is_big_boss:boolean = false;
|
||||
|
||||
rate:number=0;
|
||||
r_up:number=0;
|
||||
hp: number = 100; /** 血量 */
|
||||
hp_max: number = 100; /** 最大血量 */
|
||||
hp_speed: number = 0; //每秒回复量
|
||||
@@ -90,7 +90,7 @@ export class HeroViewComp extends CCComp {
|
||||
onLoad() {
|
||||
this.as = this.getComponent(HeroSpine);
|
||||
let anm = this.node.getChildByName("anm")
|
||||
anm.setScale(anm.scale.x*0.7,anm.scale.y*0.7);
|
||||
anm.setScale(anm.scale.x*0.8,anm.scale.y*0.8);
|
||||
// 注册单个碰撞体的回调函数
|
||||
|
||||
// let collider = this.getComponent(Collider2D);
|
||||
@@ -102,16 +102,10 @@ export class HeroViewComp extends CCComp {
|
||||
// collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
|
||||
// // collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
|
||||
// }
|
||||
// this.rigid = this.getComponent(RigidBody2D);
|
||||
// if(this.rigid.sleep){
|
||||
// console.log("hero rigid sleep ",this.scale,this.rigid);
|
||||
// this.rigid.wakeUp();
|
||||
// }
|
||||
|
||||
}
|
||||
// onBeginContact (seCol: Collider2D, oCol: Collider2D) {
|
||||
// console.log("碰撞开始 ",this.scale,seCol,oCol);
|
||||
|
||||
|
||||
// }
|
||||
// onEndContact (seCol: Collider2D, oCol: Collider2D) { console.log("碰撞结束 ",this.scale,seCol,oCol);}
|
||||
// onPreSolve (seCol: Collider2D, oCol: Collider2D) {console.log("碰撞预处理 ",this.scale,seCol,oCol);}
|
||||
@@ -133,10 +127,10 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
update(dt: number){
|
||||
if(!smc.mission.play||smc.mission.pause) return
|
||||
if(this.is_dead) {
|
||||
if(!this.in_grave()) this.to_grave()
|
||||
return
|
||||
}
|
||||
// if(this.is_dead) {
|
||||
// this.ent.destroy();
|
||||
// return
|
||||
// }
|
||||
this.hp_show()
|
||||
if(this.ice_cd > 0){
|
||||
this.ice_cd -=dt;
|
||||
@@ -248,31 +242,23 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
//掉落物品
|
||||
to_drop(){
|
||||
let Drops = getMonsterDrops(1, MonsterType.Normal, 1.2);
|
||||
if(this.is_boss) Drops =getMonsterDrops(1, MonsterType.Elite, 1.2);
|
||||
if(this.is_big_boss) Drops =getMonsterDrops(1, MonsterType.Boss, 1.2);
|
||||
// let Drops = getMonsterDrops(1, MonsterType.Normal, 1.2);
|
||||
// if(this.is_boss) Drops =getMonsterDrops(1, MonsterType.Elite, 1.2);
|
||||
// if(this.is_big_boss) Drops =getMonsterDrops(1, MonsterType.Boss, 1.2);
|
||||
}
|
||||
//进入墓地
|
||||
to_grave(){
|
||||
let pos =v3(-1000,this.node.position.y,this.node.position.z)
|
||||
if(this.fac==1) pos.x=1000
|
||||
this.node.setPosition(pos)
|
||||
}
|
||||
//是否在墓地
|
||||
in_grave(){
|
||||
return this.node.position.y <= -900;
|
||||
}
|
||||
to_alive(){
|
||||
let pos =v3(HeroSet.Start_x[this.type],HeroSet.Start_y[this.type],this.node.position.z)
|
||||
this.node.setPosition(pos)
|
||||
this.revive()
|
||||
}
|
||||
|
||||
to_console(value:any,value2:any=null,value3:any=null){
|
||||
console.log("["+this.scale+this.hero_name+']'+value,value2,value3)
|
||||
}
|
||||
reset() {
|
||||
this.is_dead = false;
|
||||
this.node.destroy();
|
||||
const collider = this.getComponent(Collider2D);
|
||||
if (collider) {
|
||||
collider.off(Contact2DType.BEGIN_CONTACT);
|
||||
}
|
||||
this.scheduleOnce(() => {
|
||||
this.node.destroy();
|
||||
}, 0.1);
|
||||
}
|
||||
playSkillEffect(skill_id:number) {
|
||||
let skill = SkillSet[skill_id]
|
||||
|
||||
@@ -1,37 +1,22 @@
|
||||
/*
|
||||
* @Author: dgflash
|
||||
* @Date: 2021-11-18 17:47:56
|
||||
* @LastEditors: dgflash
|
||||
* @LastEditTime: 2022-08-04 15:43:04
|
||||
*/
|
||||
import { instantiate, Node, Prefab, Vec3 ,v3,resources,SpriteFrame,Sprite,SpriteAtlas} from "cc";
|
||||
import { UICallbacks } from "../../../../extensions/oops-plugin-framework/assets/core/gui/layer/Defines";
|
||||
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { UIID } from "../common/config/GameUIConfig";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroModelComp } from "./HeroModelComp";
|
||||
import { HeroSpine } from "./HeroSpine";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { HeroInfo } from "../common/config/heroSet";
|
||||
import { Talents } from "../common/config/TalentSet";
|
||||
import { MonModelComp } from "./MonModelComp";
|
||||
import { BattleMoveComp } from "../common/ecs/position/BattleMoveComp";
|
||||
import { HeroSkillsComp } from "../skill/heroSkillsComp";
|
||||
/** 角色实体 */
|
||||
@ecs.register(`Monster`)
|
||||
export class Monster extends ecs.Entity {
|
||||
HeroModel!: MonModelComp;
|
||||
HeroView!: HeroViewComp;
|
||||
BattleMove!: BattleMoveComp;
|
||||
HeroSkills!: HeroSkillsComp;
|
||||
|
||||
protected init() {
|
||||
this.addComponents<ecs.Comp>(
|
||||
BattleMoveComp,
|
||||
HeroSkillsComp,
|
||||
MonModelComp
|
||||
);
|
||||
}
|
||||
@@ -46,7 +31,7 @@ export class Monster extends ecs.Entity {
|
||||
scale=-1
|
||||
let box_group=BoxSet.MONSTER
|
||||
console.log("mon load",uuid)
|
||||
this.addComponents<ecs.Comp>( MonModelComp, BattleMoveComp);
|
||||
// this.addComponents<ecs.Comp>( MonModelComp, BattleMoveComp);
|
||||
var path = "game/heros/"+HeroInfo[uuid].path;
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
@@ -67,8 +52,6 @@ export class Monster extends ecs.Entity {
|
||||
var hv = node.getComponent(HeroViewComp)!;
|
||||
// console.log("hero_init",buff)
|
||||
let hero= HeroInfo[uuid] // 共用英雄数据
|
||||
let talent= smc.vmdata.talent //角色英雄数据
|
||||
let talents=Talents;
|
||||
hv.scale = scale;
|
||||
hv.fac = 1;
|
||||
hv.type = hero.type;
|
||||
@@ -84,42 +67,7 @@ export class Monster extends ecs.Entity {
|
||||
hv.atk_skill=hero.skills[0]
|
||||
this.add(hv);
|
||||
|
||||
// // 初始化多个技能组件
|
||||
// const skillsComp = this.get(HeroSkillsComp);
|
||||
// // 正确初始化已有技能
|
||||
// hero.skills.forEach(skillId => {
|
||||
// this.addSkill(skillId); // 使用addSkill方法确保初始化
|
||||
// });
|
||||
|
||||
// 初始化移动参数
|
||||
const move = this.get(BattleMoveComp);
|
||||
move.direction = 1; // 向右移动
|
||||
move.targetX = 800; // 右边界
|
||||
}
|
||||
// 添加技能
|
||||
public addSkill(skillId: number) {
|
||||
const comp = this.get(HeroSkillsComp);
|
||||
if (comp.skills.indexOf(skillId) === -1) {
|
||||
comp.skills.push(skillId);
|
||||
comp.cooldowns.set(skillId, 0);
|
||||
comp.counters.set(skillId, 0);
|
||||
console.log(`技能${skillId}初始化完成`,
|
||||
'当前cooldowns:', comp.cooldowns,
|
||||
'当前counters:', comp.counters);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 移除技能
|
||||
public removeSkill(skillId: number) {
|
||||
const comp = this.get(HeroSkillsComp);
|
||||
comp.skills = comp.skills.filter(id => id !== skillId);
|
||||
}
|
||||
|
||||
public levelUp() {
|
||||
// ...升级逻辑...
|
||||
const comp = this.get(HeroSkillsComp);
|
||||
comp.skills.forEach(skillId => {
|
||||
comp.resetCooldown(skillId);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,10 @@ export class CardComp extends CCComp {
|
||||
show.getChildByName("name").getComponent(Label).string=HeroInfo[uuid].name
|
||||
show.getChildByName("ap").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].ap.toString()
|
||||
show.getChildByName("hp").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].hp.toString()
|
||||
show.getChildByName("type").getChildByName("war").active=HeroInfo[uuid].type==0
|
||||
show.getChildByName("type").getChildByName("bow").active=HeroInfo[uuid].type==1
|
||||
show.getChildByName("type").getChildByName("mag").active=HeroInfo[uuid].type==2
|
||||
show.getChildByName("lv").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].lv.toString()
|
||||
var icon_path = "game/heros/herois"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = show.getChildByName("mask").getChildByName("icon").getComponent(Sprite);
|
||||
|
||||
@@ -33,9 +33,12 @@ export class MissionComp extends CCComp {
|
||||
mission_buff_up_exp:number = 99999999
|
||||
MSComp:MSkillComp=null
|
||||
MMSComp:MSkillComp=null
|
||||
|
||||
|
||||
heros_node:any=null
|
||||
heros_node_pos:any=v3(0,0,0)
|
||||
herosc_node:any=null
|
||||
hero_args:any=null
|
||||
onLoad(){
|
||||
// this.on(GameEvent.UserHeroCard,this.show_herosc,this)
|
||||
// this.MSComp=this.node.getChildByName("msk").getComponent(MSkillComp)
|
||||
// this.MMSComp=this.node.getChildByName("mmsk").getComponent(MSkillComp)
|
||||
// this.MSComp.group=BoxSet.HERO
|
||||
@@ -44,6 +47,11 @@ export class MissionComp extends CCComp {
|
||||
// this.MMSComp.s_uuid=smc.mission.mmskill
|
||||
}
|
||||
start() {
|
||||
this.heros_node=this.node.getChildByName("heros")
|
||||
this.herosc_node=this.node.getChildByName("herosc")
|
||||
this.herosc_node.active=false
|
||||
this.node.getChildByName('hbg').active=false
|
||||
this.heros_node_pos=v3(this.heros_node.position.x,this.heros_node.position.y,this.heros_node.position.z)
|
||||
// this.VictoryComp=this.node.getChildByName("victory").getComponent(VictoryComp)
|
||||
}
|
||||
|
||||
@@ -51,19 +59,37 @@ export class MissionComp extends CCComp {
|
||||
if(!smc.mission.play||smc.mission.pause){
|
||||
return
|
||||
}
|
||||
if(this.fight_start){
|
||||
this.check_mon_num()
|
||||
}
|
||||
this.count_hero_pos()
|
||||
this.count_mon_pos()
|
||||
|
||||
// if (this.game_timer.update(dt)) {
|
||||
// smc.vmdata.game.g_time += 1;
|
||||
// }
|
||||
// this.shuaxin(dt)
|
||||
}
|
||||
}
|
||||
show_herosc(event: string, args: any){
|
||||
this.node.getChildByName('hbg').active=true
|
||||
const screenSize = this.node.getComponent(UITransform).contentSize;
|
||||
const centerY = screenSize.height / 2;
|
||||
tween(this.heros_node).to(0.1,{position:v3(this.heros_node.position.x,centerY,0)}, // 这里以node的位置信息坐标缓动的目标
|
||||
{ // ITweenOption 的接口实现:
|
||||
onComplete:()=>{
|
||||
|
||||
this.herosc_node.active=true
|
||||
this.heros_node.active=false
|
||||
this.hero_args=args
|
||||
}
|
||||
}).start()
|
||||
}
|
||||
call_hero(event: string, args: any){
|
||||
console.log("call_hero",args)
|
||||
oops.message.dispatchEvent(GameEvent.CallHero,{uuid:this.hero_args.uuid,pos:args})
|
||||
this.herosc_node.active=false
|
||||
this.heros_node.active=true
|
||||
this.heros_node.position=this.heros_node_pos
|
||||
this.hero_args=null
|
||||
this.node.getChildByName('hbg').active=false
|
||||
}
|
||||
mission_start(){
|
||||
/* todo 关卡设定完善*/
|
||||
console.log("mission_start Missions mons:",Missions[smc.mission.lv])
|
||||
console.log("战斗开始 Missions mons:",Missions[smc.mission.lv])
|
||||
smc.mission.status=1
|
||||
this.colose_victory()
|
||||
this.mission_init()
|
||||
@@ -109,71 +135,14 @@ export class MissionComp extends CCComp {
|
||||
this.MSComp.init()
|
||||
this.MMSComp.init()
|
||||
}
|
||||
check_mon_num(){
|
||||
let mons:any = this.get_mons()
|
||||
let heros:any= this.get_heros()
|
||||
let h_alive=false
|
||||
let m_alive=false
|
||||
for (let i = 0; i < heros.length; i++) {
|
||||
if ( !heros[i].HeroView.is_dead) {
|
||||
h_alive=true
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < mons.length; i++) {
|
||||
if ( !mons[i].HeroView.is_dead) {
|
||||
m_alive=true
|
||||
}
|
||||
}
|
||||
// if (!m_alive||!h_alive) this.mission_end()
|
||||
}
|
||||
|
||||
|
||||
get_mons(){
|
||||
return ecs.query(ecs.allOf(MonModelComp));
|
||||
}
|
||||
get_heros(){
|
||||
return ecs.query(ecs.allOf(HeroModelComp))
|
||||
}
|
||||
count_mon_pos(){
|
||||
let right_x:number=360
|
||||
let left_x:number=-360
|
||||
let monsters:any= this.get_mons()
|
||||
for(let i=0;i<monsters.length;i++){
|
||||
if(monsters[i].HeroView == undefined) return
|
||||
if(monsters[i].HeroView.node.position.x > 400) continue
|
||||
let mon:any = monsters[i].HeroView.node.position
|
||||
smc.enemy_pos[i]= mon
|
||||
if(monsters[i].HeroView.node.position.x > left_x){
|
||||
left_x = monsters[i].HeroView.node.position.x
|
||||
}
|
||||
if(monsters[i].HeroView.node.position.x < right_x){
|
||||
right_x = monsters[i].HeroView.node.position.x
|
||||
}
|
||||
}
|
||||
smc.mon_front_x=right_x
|
||||
smc.mon_back_x=left_x
|
||||
// console.log("count_mon_pos",smc.mon_pos,smc.mon_front_x,smc.mon_back_x)
|
||||
}
|
||||
count_hero_pos(){
|
||||
let right_x:number=360
|
||||
let left_x:number=-360
|
||||
let heros:any= this.get_heros()
|
||||
for(let i=0;i<heros.length;i++){
|
||||
if(heros[i].HeroView == undefined) return
|
||||
if(heros[i].HeroView.node.position.x < -400) continue
|
||||
|
||||
let ho:any = heros[i].HeroView.node.position
|
||||
smc.hero_pos[i]= ho
|
||||
if(heros[i].HeroView.node.position.x > left_x){
|
||||
left_x = heros[i].HeroView.node.position.x
|
||||
}
|
||||
if(heros[i].HeroView.node.position.x < right_x){
|
||||
right_x = heros[i].HeroView.node.position.x
|
||||
}
|
||||
}
|
||||
smc.hero_front_x=left_x
|
||||
smc.hero_back_x=right_x
|
||||
// console.log("count_hero_pos",smc.hero_pos,smc.hero_front_x,smc.mon_front_x)
|
||||
}
|
||||
|
||||
card_refresh(){
|
||||
oops.message.dispatchEvent(GameEvent.CardRefresh)
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ import { _decorator, v3, Vec3 } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { HeroInfo, HeroList, HeroSet } from "../common/config/heroSet";
|
||||
import { HeroInfo, HeroList, HeroPos, HeroSet } from "../common/config/heroSet";
|
||||
import { Hero } from "../hero/Hero";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { Timer } from "db://oops-framework/core/common/timer/Timer";
|
||||
import { RandomManager } from "db://oops-framework/core/common/random/RandomManager";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { HeroModelComp } from "../hero/HeroModelComp";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -16,6 +18,11 @@ const { ccclass, property } = _decorator;
|
||||
@ecs.register('MissionHeroComp', false)
|
||||
export class MissionHeroCompComp extends CCComp {
|
||||
timer:Timer=new Timer(2)
|
||||
start_pos:any={
|
||||
0:{pos:v3(-140,130,0),has:false},
|
||||
1:{pos:v3(-220,130,0),has:false},
|
||||
2:{pos:v3(-300,130,0),has:false},
|
||||
}
|
||||
onLoad(){
|
||||
this.on(GameEvent.UserHeroCard,this.call_hero,this)
|
||||
}
|
||||
@@ -27,7 +34,9 @@ export class MissionHeroCompComp extends CCComp {
|
||||
|
||||
}
|
||||
init(){
|
||||
|
||||
this.start_pos[0].has=false
|
||||
this.start_pos[1].has=false
|
||||
this.start_pos[2].has=false
|
||||
}
|
||||
test_call(){
|
||||
this.addHero(5010)
|
||||
@@ -41,12 +50,30 @@ export class MissionHeroCompComp extends CCComp {
|
||||
this.addHero(uuid)
|
||||
}
|
||||
/** 添加玩家 */
|
||||
private addHero(uuid:number=1001,i:number=0) {
|
||||
private addHero(uuid:number=1001) {
|
||||
console.log("call_hero addHero",uuid)
|
||||
let info:any={ap:0,hp:0}
|
||||
if(this.start_pos[HeroInfo[uuid].type].has){
|
||||
info=this.remove_hero(HeroInfo[uuid].type)
|
||||
}
|
||||
let hero = ecs.getEntity<Hero>(Hero);
|
||||
let scale = 1
|
||||
let y=RandomManager.instance.getRandomInt(0,HeroSet.Start_y.length,1)
|
||||
let pos:Vec3 = v3(HeroSet.Start_x[HeroInfo[uuid].type],HeroSet.Start_y[y]);
|
||||
hero.load(pos,scale,uuid);
|
||||
let pos:Vec3 = v3(HeroPos[HeroInfo[uuid].type].pos);
|
||||
hero.load(pos,scale,uuid,info);
|
||||
this.start_pos[HeroInfo[uuid].type].has=true
|
||||
}
|
||||
remove_hero(i:number){
|
||||
let info:any={ap:0,hp:0}
|
||||
let heros=ecs.query(ecs.allOf(HeroModelComp))
|
||||
for(let hero of heros){
|
||||
if(hero.get(HeroViewComp).node.position.x==HeroPos[i].pos.x){
|
||||
info.ap=hero.get(HeroViewComp).ap*(100+hero.get(HeroViewComp).r_up)/100
|
||||
info.hp=hero.get(HeroViewComp).hp*(100+hero.get(HeroViewComp).r_up)/100
|
||||
hero.destroy()
|
||||
return info
|
||||
}
|
||||
}
|
||||
return info
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
|
||||
@@ -15,7 +15,7 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('MissionMonCompComp')
|
||||
@ecs.register('MissionMonComp', false)
|
||||
export class MissionMonCompComp extends CCComp {
|
||||
timer:Timer=new Timer(5)
|
||||
timer:Timer=new Timer(3)
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
@@ -42,39 +42,23 @@ export class MissionMonCompComp extends CCComp {
|
||||
let tc=1
|
||||
let yc=2
|
||||
let bc=1
|
||||
for(let i=0;i<tc;i++){
|
||||
let x=RandomManager.instance.getRandomInt(0,t_num,1)
|
||||
this.addMonster(Missions[0][x],i)
|
||||
console.log("Missions t:"+x,Missions[0][x])
|
||||
}
|
||||
for(let i=0;i<yc;i++){
|
||||
let x=RandomManager.instance.getRandomInt(0,y_num,1)
|
||||
this.addMonster(Missions[1][x],i)
|
||||
console.log("Missions y:"+x,Missions[1][x])
|
||||
}
|
||||
for(let i=0;i<bc;i++){
|
||||
let x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
x=RandomManager.instance.getRandomInt(0,b_num,1)
|
||||
console.log("Missions b:"+x,Missions[2][x])
|
||||
this.addMonster(Missions[2][x],i,true)
|
||||
}
|
||||
let x=RandomManager.instance.getRandomInt(0,y_num,1)
|
||||
this.addMonster(Missions[0][x],0)
|
||||
x=RandomManager.instance.getRandomInt(0,y_num,1)
|
||||
this.addMonster(Missions[0][x],1)
|
||||
x=RandomManager.instance.getRandomInt(0,y_num,1)
|
||||
this.addMonster(Missions[0][x],2)
|
||||
x=RandomManager.instance.getRandomInt(0,y_num,1)
|
||||
this.addMonster(Missions[0][x],3)
|
||||
|
||||
console.log("Missions t:"+x,Missions[0][x])
|
||||
|
||||
}
|
||||
|
||||
private addMonster(uuid:number=1001,i:number=0,is_boss:boolean=false) {
|
||||
let mon = ecs.getEntity<Monster>(Monster);
|
||||
let scale = -1
|
||||
let x=RandomManager.instance.getRandomInt(0,MonSet.Start_x.length,1)
|
||||
let y=RandomManager.instance.getRandomInt(0,MonSet.Start_y.length,1)
|
||||
let pos:Vec3 = v3(MonSet.Start_x[2],MonSet.Start_y[y]);
|
||||
let pos:Vec3 = v3(MonSet[i].pos);
|
||||
mon.load(pos,scale,uuid,is_boss);
|
||||
}
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
|
||||
@@ -43,34 +43,31 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
private castSkill(caster: ecs.Entity, skillId: number, config: typeof SkillSet[keyof typeof SkillSet]) {
|
||||
const view = caster.get(HeroViewComp);
|
||||
const skillEntity = ecs.getEntity<Skill>(Skill);
|
||||
console.log(view.hero_name+"施放技能:"+config.uuid+"=>"+view.hero_name);
|
||||
console.log(view.uuid+"=>"+view.hero_name+"施放技能:"+config.uuid);
|
||||
if (config.TargetGroup === TargetGroup.Enemy) {
|
||||
const targets = this.selectEnemyTargets(caster, config);
|
||||
console.log("敌人 targets:"+targets);
|
||||
if (targets.length === 0) return;
|
||||
skillEntity.load(
|
||||
new Vec3(view.node.position.x, view.node.position.y+BoxSet.ATK_Y, 0), // 起始位置
|
||||
view.fac, // 阵营
|
||||
view.box_group, // 阵营
|
||||
view.node.parent, // 父节点
|
||||
config.uuid, // 技能ID
|
||||
new Vec3(targets[0]?.get(HeroViewComp).node.position.x, targets[0]?.get(HeroViewComp).node.position.y, 0), // 目标位置
|
||||
targets[0]?.get(HeroViewComp),
|
||||
view
|
||||
);
|
||||
targets.forEach(target => {
|
||||
this.applySkillEffect(caster, target, config,skillEntity);
|
||||
console.log("施放技能:"+config.uuid+"=>"+target.get(HeroViewComp).hero_name);
|
||||
});
|
||||
caster.get(HeroViewComp).playSkillEffect(config.uuid);
|
||||
console.log("技能:"+config.uuid+"=>"+targets[0]?.get(HeroViewComp).hero_name);
|
||||
}
|
||||
|
||||
if (config.TargetGroup === TargetGroup.Ally) {
|
||||
const targets = this.selectAllyTargets(caster, config);
|
||||
if (targets.length === 0) return;
|
||||
targets.forEach(target => {
|
||||
this.applySkillEffect(caster, target, config,skillEntity);
|
||||
});
|
||||
|
||||
}
|
||||
if (config.TargetGroup === TargetGroup.Self) {
|
||||
this.applySkillEffect(caster, caster, config,skillEntity);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,13 +116,6 @@ export class HeroSkillSystem extends ecs.ComblockSystem implements ecs.ISystemUp
|
||||
return shuffled.slice(0, count);
|
||||
}
|
||||
|
||||
/** 应用技能效果 */
|
||||
private applySkillEffect(caster: ecs.Entity, target: ecs.Entity, config: typeof SkillSet[keyof typeof SkillSet],skillEntity:ecs.Entity) {
|
||||
const casterView = caster.get(HeroViewComp);
|
||||
// 播放技能特效
|
||||
casterView.playSkillEffect(config.uuid);
|
||||
|
||||
}
|
||||
|
||||
public clear_timer() {
|
||||
console.log("clear_timer");
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
import { Node, Vec3 } from "cc";
|
||||
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { HeroSkillsComp } from "./heroSkillsComp";
|
||||
import { endType, SkillSet, TargetGroup, TargetType } from "../common/config/SkillSet";
|
||||
import { CdType } from "../common/config/SkillSet";
|
||||
import { oops } from "db://oops-framework/core/Oops";
|
||||
import { GameEvent } from "../common/config/GameEvent";
|
||||
import { Skill } from "../skills/Skill";
|
||||
import { SkillCom } from "../skills/SkillCom";
|
||||
import { AnimType } from "../common/config/SkillSet";
|
||||
|
||||
|
||||
/** 技能系统 */
|
||||
@ecs.register('SkillSystem')
|
||||
export class SkillSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate {
|
||||
private _timers: { [key: string]: number } = {};
|
||||
private _damageQueue: Array<{ timer: number; callback: () => void }> = [];
|
||||
private readonly SKILL_RANGE_X = 10; // x轴判定范围
|
||||
private readonly SKILL_RANGE_Y = 10; // y轴判定范围
|
||||
init(): void {
|
||||
oops.message.on(GameEvent.MissionEnd, this.clear_timer, this);
|
||||
}
|
||||
filter(): ecs.IMatcher {
|
||||
return ecs.allOf(SkillCom);
|
||||
}
|
||||
|
||||
|
||||
update(e: ecs.Entity) {
|
||||
const skill = e.get(SkillCom);
|
||||
if(this.checkSkill(skill)){
|
||||
if(skill.atk_count < 1){
|
||||
skill.atk_count++;
|
||||
// console.log("技能命中目标",skill.caster,skill.target,SkillSet[skill.s_uuid]);
|
||||
this.applySkillEffect(skill.caster,skill.target,SkillSet[skill.s_uuid],e);
|
||||
}
|
||||
}
|
||||
this.processDamageQueue();
|
||||
|
||||
}
|
||||
|
||||
private processDamageQueue() {
|
||||
const delta = this.dt;
|
||||
for (let i = this._damageQueue.length - 1; i >= 0; i--) {
|
||||
this._damageQueue[i].timer -= delta;
|
||||
if (this._damageQueue[i].timer <= 0) {
|
||||
this._damageQueue[i].callback();
|
||||
this._damageQueue.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
checkSkill(skill: SkillCom) {
|
||||
const targetPos = skill.target.node.position;
|
||||
const target = skill.target;
|
||||
const skillPos = skill.node.position;
|
||||
// 根据技能配置获取判定范围
|
||||
const config = SkillSet[skill.s_uuid];
|
||||
const rangeX = config?.rangeX || 30; // 默认值为10
|
||||
const rangeY = config?.rangeY || 40;
|
||||
const distanceX = Math.abs(targetPos.x - skillPos.x);
|
||||
const distanceY = Math.abs(targetPos.y+40 - skillPos.y);
|
||||
const isInRange = distanceX < rangeX && distanceY < rangeY;
|
||||
return isInRange;
|
||||
}
|
||||
/** 应用技能效果 */
|
||||
private applySkillEffect(casterView:HeroViewComp, targetView: HeroViewComp, config: typeof SkillSet[keyof typeof SkillSet],e:ecs.Entity) {
|
||||
// 直接计算伤害(包含防御减免)
|
||||
const damageResult = this.calculateDamage(casterView, targetView, config);
|
||||
// 将施法者传入applyDamage方法
|
||||
this.applyDamage(targetView,damageResult);
|
||||
// 播放技能特效
|
||||
casterView.playSkillEffect(config.uuid);
|
||||
console.log(`${casterView.hero_name} 对 ${targetView.hero_name} 造成 ${damageResult.value}伤害`);
|
||||
if(config.endType === endType.collision){
|
||||
e.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private calculateDamage(caster: HeroViewComp, target: HeroViewComp, config: typeof SkillSet[keyof typeof SkillSet]) {
|
||||
const result = {
|
||||
value: 0,
|
||||
isCrit: false,
|
||||
isDodged: false,
|
||||
delay: 0.3, // 默认延迟
|
||||
ignoreDefense: false,
|
||||
canCrit: true,
|
||||
}
|
||||
let final = caster.ap * config.ap / 100;
|
||||
// 伤害浮动(±10%)
|
||||
const damageFloat = 0.9 + Math.random() * 0.2; // 0.9~1.1
|
||||
final *= damageFloat;
|
||||
final = Math.round(final);
|
||||
result.value = Math.max(1, final); // 确保最小伤害为1
|
||||
result.isCrit = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
private applyDamage(targetView: HeroViewComp, result: any,) {;
|
||||
|
||||
this._damageQueue.push({
|
||||
timer: 0,
|
||||
callback: () => {
|
||||
if (!targetView?.ent.has(HeroViewComp)) return;
|
||||
|
||||
let remainingDamage = result.value;
|
||||
if (targetView.shield > 0) {
|
||||
const shieldAbsorb = Math.min(targetView.shield, remainingDamage);
|
||||
targetView.shield -= shieldAbsorb;
|
||||
remainingDamage -= shieldAbsorb;
|
||||
|
||||
if (targetView.shield <= 0) {
|
||||
targetView.BUFFCOMP.show_shield(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (remainingDamage > 0) {
|
||||
targetView.hp -= remainingDamage;
|
||||
if(targetView.hp <= 0) {
|
||||
targetView.BUFFCOMP.dead()
|
||||
targetView.to_grave();
|
||||
}
|
||||
targetView.showDamage(result.value, true);
|
||||
} else {
|
||||
targetView.BUFFCOMP.tooltip(5,"*吸收*");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public clear_timer() {
|
||||
console.log("clear_timer");
|
||||
Object.values(this._timers).forEach(clearTimeout);
|
||||
}
|
||||
onDestroy() {
|
||||
Object.values(this._timers).forEach(clearTimeout);
|
||||
}
|
||||
|
||||
|
||||
/** 应用负面状态 */
|
||||
private applyDebuff(target: ecs.Entity, config: typeof SkillSet[keyof typeof SkillSet]) {
|
||||
// 实现debuff逻辑...
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -41,27 +41,24 @@ export class Skill extends ecs.Entity {
|
||||
// 设置节点属性
|
||||
node.parent = parent;
|
||||
node.setPosition(startPos);
|
||||
console.log("加载预制体:",startPos,targetPos)
|
||||
// console.log("加载预制体:",startPos,targetPos)
|
||||
// 添加技能组件
|
||||
const skillComp = node.getComponent(SkillCom); // 初始化技能参数
|
||||
skillComp.ap = caster.ap;
|
||||
skillComp.s_uuid = uuid;
|
||||
skillComp.animType = config.AnimType;
|
||||
skillComp.endType = config.endType;
|
||||
skillComp.speed = config.speed;
|
||||
skillComp.inTime = config.in;
|
||||
skillComp.atk_count = 0;
|
||||
skillComp.startPos = v3(startPos.x,BoxSet.GAME_LINE+35,0)
|
||||
skillComp.targetPos = v3(targetPos.x,BoxSet.GAME_LINE+50,0)
|
||||
skillComp.startPos = startPos
|
||||
skillComp.targetPos =targetPos
|
||||
skillComp.target = target;
|
||||
skillComp.caster = caster;
|
||||
skillComp.prefabName = config.sp_name;
|
||||
skillComp.group = group;
|
||||
skillComp.fac = group;
|
||||
if(group==BoxSet.HERO){
|
||||
skillComp.fac=0;
|
||||
}else{
|
||||
skillComp.fac=1;
|
||||
}
|
||||
skillComp.fac= group==BoxSet.HERO?0:1;
|
||||
|
||||
console.log(config.sp_name+"技能配置",skillComp);
|
||||
// 初始化动画名称
|
||||
skillComp.animName = config.animName; // 从配置获取动画名称
|
||||
|
||||
@@ -8,6 +8,7 @@ import { AnimType, endType, SkillSet } from "../common/config/SkillSet";
|
||||
import { EndAnmCom } from './EndAnmCom';
|
||||
import { BoxSet } from "../common/config/BoxSet";
|
||||
import { HeroFac, HeroSet } from "../common/config/heroSet";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
@@ -36,11 +37,11 @@ export class SkillCom extends CCComp {
|
||||
animName: string = "";
|
||||
group:number = 0; //阵营
|
||||
fac:number=0; //阵营
|
||||
rigid:RigidBody2D=null!; // 动画名称
|
||||
target:any=null;
|
||||
caster:any=null;
|
||||
distance_x:number=0;
|
||||
distance_y:number=0;
|
||||
ap:number=0;
|
||||
private moveDirection: Vec3 | null = null; // 添加一个属性来存储移动方向
|
||||
|
||||
protected onLoad(): void {
|
||||
@@ -51,19 +52,12 @@ export class SkillCom extends CCComp {
|
||||
start() {
|
||||
oops.message.on(GameEvent.MissionEnd, this.doDestroy, this);
|
||||
this.node.active = true;
|
||||
// let collider = this.getComponent(Collider2D);
|
||||
// console.log(this.group +"技能 collider ",collider);
|
||||
// collider.group = this.group;
|
||||
// if (collider) {
|
||||
// collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
|
||||
// }
|
||||
// this.rigid = this.getComponent(RigidBody2D);
|
||||
// if(this.rigid.sleep){
|
||||
// console.log(this.scale+"技能 rigid sleep ",this.rigid);
|
||||
// this.rigid.wakeUp();
|
||||
// }
|
||||
// 根据动画类型开始相应的运动
|
||||
let collider = this.getComponent(Collider2D);
|
||||
console.log(this.group +"技能 collider ",collider);
|
||||
collider.group = this.group;
|
||||
if (collider) {
|
||||
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
|
||||
}
|
||||
let dir_x = this.target.node.position.x > this.node.position.x ? 1 : -1
|
||||
this.node.scale = v3(dir_x,1,1)
|
||||
// 根据目标位置设置节点朝向
|
||||
@@ -104,9 +98,35 @@ export class SkillCom extends CCComp {
|
||||
|
||||
this.startMovement();
|
||||
}
|
||||
// onBeginContact (seCol: Collider2D, oCol: Collider2D) {
|
||||
// console.log(this.scale+"碰撞开始 ",seCol,oCol);
|
||||
// }
|
||||
onBeginContact (seCol: Collider2D, oCol: Collider2D) {
|
||||
console.log(this.scale+"碰撞开始 ",seCol,oCol);
|
||||
let target = oCol.getComponent(HeroViewComp)
|
||||
let caster = seCol.getComponent(HeroViewComp)
|
||||
if(oCol.group!=this.group){
|
||||
if(target == null) return;
|
||||
let remainingDamage = this.ap;
|
||||
if (target.shield > 0) {
|
||||
target.shield -= 1
|
||||
target.BUFFCOMP.tooltip(5,"*吸收*");
|
||||
remainingDamage = 0
|
||||
if (target.shield <= 0) {
|
||||
if(target == null) return;
|
||||
target.BUFFCOMP.show_shield(false);
|
||||
}
|
||||
}else{
|
||||
if(target == null) return;
|
||||
target.hp -= remainingDamage;
|
||||
if(target.hp <= 0) {
|
||||
if(target == null) return;
|
||||
target.BUFFCOMP.dead()
|
||||
if(target.ent == null) return;
|
||||
target.ent.destroy();
|
||||
}
|
||||
target.showDamage(remainingDamage, true);
|
||||
}
|
||||
this.ent.destroy()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -244,7 +264,6 @@ export class SkillCom extends CCComp {
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.is_destroy = false;
|
||||
this.node.destroy();
|
||||
this.animType = 0;
|
||||
this.endType = 0;
|
||||
this.speed = 0;
|
||||
@@ -252,6 +271,14 @@ export class SkillCom extends CCComp {
|
||||
this.startPos.set();
|
||||
this.targetPos.set();
|
||||
this.moveDirection = null; // 重置移动方向
|
||||
// 先移除所有碰撞回调
|
||||
const collider = this.getComponent(Collider2D);
|
||||
if (collider) {
|
||||
collider.off(Contact2DType.BEGIN_CONTACT);
|
||||
}
|
||||
this.scheduleOnce(() => {
|
||||
this.node.destroy();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user