技能移动修改

This commit is contained in:
2024-08-21 14:10:17 +08:00
parent 3f18763730
commit 76a7854e94
15 changed files with 161 additions and 104 deletions

View File

@@ -1,6 +1,6 @@
{
"skeleton": {
"hash": "bsy2+rhYPpHUoKMly9k7+zmodZw",
"hash": "c3y/VNkNaxtG7u8CpZHPWePN2T8",
"spine": "3.8.99",
"x": -0.82,
"y": 24.4,
@@ -32,14 +32,15 @@
"bone": {
"scale": [
{},
{ "time": 0.3, "x": 0.682 },
{ "time": 0.4, "x": 1.06 },
{ "time": 0.5 }
{ "time": 0.2, "x": 0.682 },
{ "time": 0.4667, "x": 1.06 },
{ "time": 0.6 }
],
"shear": [
{},
{ "time": 0.3, "x": 1.67, "y": 29.28 },
{ "time": 0.4 }
{ "time": 0.2, "y": 29.28 },
{ "time": 0.4667, "y": -30 },
{ "time": 0.6 }
]
}
}
@@ -62,7 +63,7 @@
"bone": {
"scale": [
{},
{ "time": 0.5, "x": 0.768, "y": 0.896 },
{ "time": 0.5, "x": 0.937, "y": 0.937 },
{ "time": 1 }
]
}

View File

@@ -426,7 +426,7 @@
"a": 255
},
"_spriteFrame": {
"__uuid__": "7b95dfa5-c844-44d4-8d63-302f57da2ba2@3f402",
"__uuid__": "7b95dfa5-c844-44d4-8d63-302f57da2ba2@a298b",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
@@ -521,8 +521,8 @@
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
"x": 0.05283504952715698,
"y": 2.541666525933483
},
"_id": ""
},
@@ -556,7 +556,7 @@
"__uuid__": "a80809a8-64bf-4c66-b49e-7aa837d821dd",
"__expectedType__": "sp.SkeletonData"
},
"defaultSkin": "default",
"defaultSkin": "",
"defaultAnimation": "",
"_premultipliedAlpha": false,
"_timeScale": 1,

View File

@@ -47,54 +47,54 @@ export const HeroSet ={
}
export const SkillSet={
1001:{uuid: 1001,path: "1001",type: 1,level: 1,name: "火球术-初级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
1002:{uuid: 1002,path: "1002",type: 1,level: 1,name: "寒冰箭-初级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
1003:{uuid: 1003,path: "1003",type: 1,level: 1,name: "狂暴-初级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
1004:{uuid: 1004,path: "1004",type: 1,level: 1,name: "守护-初级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
1005:{uuid: 1005,path: "1005",type: 1,level: 1,name: "雷霆-初级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
1006:{uuid: 1006,path: "1006",type: 1,level: 1,name: "再生-初级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
1007:{uuid: 1007,path: "1007",type: 1,level: 1,name: "复生-初级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
1008:{uuid: 1008,path: "1008",type: 1,level: 1,name: "灵巧-初级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
1009:{uuid: 1009,path: "1009",type: 1,level: 1,name: "盾守-初级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
1010:{uuid: 1010,path: "1010",type: 1,level: 1,name: "治愈-初级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
1011:{uuid: 1011,path: "1011",type: 1,level: 3,name: "火焰风暴-初级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
1012:{uuid: 1012,path: "1012",type: 1,level: 3,name: "冰晶风暴-初级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
2001:{uuid: 2001,path: "1001",type: 1,level: 2,name: "火球术-中级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
2002:{uuid: 2002,path: "1002",type: 1,level: 2,name: "寒冰箭-中级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
2003:{uuid: 2003,path: "1003",type: 1,level: 2,name: "狂暴-中级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
2004:{uuid: 2004,path: "1004",type: 1,level: 2,name: "守护-中级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
2005:{uuid: 2005,path: "1005",type: 1,level: 2,name: "雷霆-中级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
2006:{uuid: 2006,path: "1006",type: 1,level: 2,name: "再生-中级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
2007:{uuid: 2007,path: "1007",type: 1,level: 2,name: "复生-中级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
2008:{uuid: 2008,path: "1008",type: 1,level: 2,name: "灵巧-中级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
2009:{uuid: 2009,path: "1009",type: 1,level: 2,name: "盾守-中级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
2020:{uuid: 2010,path: "1010",type: 1,level: 2,name: "治愈-中级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
2011:{uuid: 2011,path: "1011",type: 1,level: 4,name: "火焰风暴-中级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
2012:{uuid: 2012,path: "1012",type: 1,level: 4,name: "冰晶风暴-中级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
3001:{uuid: 3001,path: "1001",type: 1,level: 3,name: "火球术-高级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
3002:{uuid: 3002,path: "1002",type: 1,level: 3,name: "寒冰箭-高级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
3003:{uuid: 3003,path: "1003",type: 1,level: 3,name: "狂暴-高级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
3004:{uuid: 3004,path: "1004",type: 1,level: 3,name: "守护-高级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
3005:{uuid: 3005,path: "1005",type: 1,level: 3,name: "雷霆-高级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
3006:{uuid: 3006,path: "1006",type: 1,level: 3,name: "再生-高级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
3007:{uuid: 3007,path: "1007",type: 1,level: 3,name: "复生-高级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
3008:{uuid: 3008,path: "1008",type: 1,level: 3,name: "灵巧-高级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
3009:{uuid: 3009,path: "1009",type: 1,level: 3,name: "盾守-高级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
3030:{uuid: 3010,path: "1010",type: 1,level: 3,name: "治愈-高级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
3011:{uuid: 3011,path: "1011",type: 1,level: 5,name: "火焰风暴-高级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
3012:{uuid: 3012,path: "1012",type: 1,level: 5,name: "冰晶风暴-高级",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
4001:{uuid: 4001,path: "1001",type: 1,level: 4,name: "火球术-终极",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
4002:{uuid: 4002,path: "1002",type: 1,level: 4,name: "寒冰箭-终极",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
4003:{uuid: 4003,path: "1003",type: 1,level: 4,name: "狂暴-终极",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
4004:{uuid: 4004,path: "1004",type: 1,level: 4,name: "守护-终极",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
4005:{uuid: 4005,path: "1005",type: 1,level: 4,name: "雷霆-终极",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
4006:{uuid: 4006,path: "1006",type: 1,level: 4,name: "再生-终极",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
4007:{uuid: 4007,path: "1007",type: 1,level: 4,name: "复生-终极",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
4008:{uuid: 4008,path: "1008",type: 1,level: 4,name: "灵巧-终极",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
4009:{uuid: 4009,path: "1009",type: 1,level: 4,name: "盾守-终极",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
4040:{uuid: 4010,path: "1010",type: 1,level: 4,name: "治愈-终极",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
4011:{uuid: 4011,path: "1011",type: 1,level: 6,name: "火焰风暴-终极",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
4012:{uuid: 4012,path: "1012",type: 1,level: 6,name: "冰晶风暴-终极",atk: 4,hp: 8,atk_cd: 2,power: 50,speed: 80,},
1001:{uuid: 1001,path: "1001",type: 1,level: 1,name: "火球术-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
1002:{uuid: 1002,path: "1002",type: 1,level: 1,name: "寒冰箭-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
1003:{uuid: 1003,path: "1003",type: 1,level: 1,name: "狂暴-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
1004:{uuid: 1004,path: "1004",type: 1,level: 1,name: "守护-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
1005:{uuid: 1005,path: "1005",type: 1,level: 1,name: "雷霆-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
1006:{uuid: 1006,path: "1006",type: 1,level: 1,name: "再生-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
1007:{uuid: 1007,path: "1007",type: 1,level: 1,name: "复生-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
1008:{uuid: 1008,path: "1008",type: 1,level: 1,name: "灵巧-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
1009:{uuid: 1009,path: "1009",type: 1,level: 1,name: "盾守-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
1010:{uuid: 1010,path: "1010",type: 1,level: 1,name: "治愈-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
1011:{uuid: 1011,path: "1011",type: 1,level: 3,name: "火焰风暴-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
1012:{uuid: 1012,path: "1012",type: 1,level: 3,name: "冰晶风暴-初级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
2001:{uuid: 2001,path: "1001",type: 1,level: 2,name: "火球术-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
2002:{uuid: 2002,path: "1002",type: 1,level: 2,name: "寒冰箭-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
2003:{uuid: 2003,path: "1003",type: 1,level: 2,name: "狂暴-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
2004:{uuid: 2004,path: "1004",type: 1,level: 2,name: "守护-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
2005:{uuid: 2005,path: "1005",type: 1,level: 2,name: "雷霆-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
2006:{uuid: 2006,path: "1006",type: 1,level: 2,name: "再生-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
2007:{uuid: 2007,path: "1007",type: 1,level: 2,name: "复生-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
2008:{uuid: 2008,path: "1008",type: 1,level: 2,name: "灵巧-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
2009:{uuid: 2009,path: "1009",type: 1,level: 2,name: "盾守-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
2020:{uuid: 2010,path: "1010",type: 1,level: 2,name: "治愈-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
2011:{uuid: 2011,path: "1011",type: 1,level: 4,name: "火焰风暴-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
2012:{uuid: 2012,path: "1012",type: 1,level: 4,name: "冰晶风暴-中级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
3001:{uuid: 3001,path: "1001",type: 1,level: 3,name: "火球术-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
3002:{uuid: 3002,path: "1002",type: 1,level: 3,name: "寒冰箭-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
3003:{uuid: 3003,path: "1003",type: 1,level: 3,name: "狂暴-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
3004:{uuid: 3004,path: "1004",type: 1,level: 3,name: "守护-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
3005:{uuid: 3005,path: "1005",type: 1,level: 3,name: "雷霆-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
3006:{uuid: 3006,path: "1006",type: 1,level: 3,name: "再生-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
3007:{uuid: 3007,path: "1007",type: 1,level: 3,name: "复生-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
3008:{uuid: 3008,path: "1008",type: 1,level: 3,name: "灵巧-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
3009:{uuid: 3009,path: "1009",type: 1,level: 3,name: "盾守-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
3030:{uuid: 3010,path: "1010",type: 1,level: 3,name: "治愈-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
3011:{uuid: 3011,path: "1011",type: 1,level: 5,name: "火焰风暴-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
3012:{uuid: 3012,path: "1012",type: 1,level: 5,name: "冰晶风暴-高级",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4001:{uuid: 4001,path: "1001",type: 1,level: 4,name: "火球术-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4002:{uuid: 4002,path: "1002",type: 1,level: 4,name: "寒冰箭-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4003:{uuid: 4003,path: "1003",type: 1,level: 4,name: "狂暴-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4004:{uuid: 4004,path: "1004",type: 1,level: 4,name: "守护-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4005:{uuid: 4005,path: "1005",type: 1,level: 4,name: "雷霆-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4006:{uuid: 4006,path: "1006",type: 1,level: 4,name: "再生-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4007:{uuid: 4007,path: "1007",type: 1,level: 4,name: "复生-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4008:{uuid: 4008,path: "1008",type: 1,level: 4,name: "灵巧-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4009:{uuid: 4009,path: "1009",type: 1,level: 4,name: "盾守-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4040:{uuid: 4010,path: "1010",type: 1,level: 4,name: "治愈-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4011:{uuid: 4011,path: "1011",type: 1,level: 6,name: "火焰风暴-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
4012:{uuid: 4012,path: "1012",type: 1,level: 6,name: "冰晶风暴-终极",sp_name:"fire",dis:720,count:1,atk: 4,sd:10,cd:1,speed:400,},
}

View File

@@ -75,8 +75,8 @@ export class MapMonsterComp extends CCComp {
let monster = ecs.getEntity<Monster>(Monster);
let pos:Vec3 = v3(BoxSet.MONSTER_START,BoxSet.GAME_LINE)
let camp = -1
monster.load(pos,camp,uuid);
let scale = -1
monster.load(pos,scale,uuid);
smc.monsters.splice(0,1)
}

View File

@@ -24,9 +24,9 @@ export class MapSkillComp extends CCComp {
}
addSkill(uuid:number=1001){
let csk =ecs.getEntity<CSkill>(CSkill);
let camp = 1
let pos = v3(BoxSet.CSKILL_X*-camp,BoxSet.CSKILL_Y)
csk.load(pos,camp,uuid);
let scale = 1
let pos = v3(BoxSet.CSKILL_X*-scale,BoxSet.CSKILL_Y)
csk.load(pos,scale,uuid);
}
doMonsterLoad(){
// const light = instantiate(this.light);

View File

@@ -78,8 +78,8 @@ export class MapViewComp extends CCComp {
this.scene.node.active = true
let hero = ecs.getEntity<Hero>(Hero);
let pos = v3(BoxSet.HERO_START,BoxSet.GAME_LINE)
let camp = 1
hero.load(pos,camp,uuid);
let scale = 1
hero.load(pos,scale,uuid);
}

View File

@@ -25,7 +25,7 @@ export class CSkill extends ecs.Entity {
}
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,camp:number = 1,uuid:number=1001) {
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001) {
// var path = "game/monster/"+prefab_path;
console.log("load skill",this)
var path = "game/heros/skill";
@@ -33,7 +33,7 @@ export class CSkill extends ecs.Entity {
var node = instantiate(prefab);
var scene = smc.map.MapView.scene;
node.parent = scene.entityLayer!.node!;
node.getChildByName("skill").setScale(node.getChildByName("skill").scale.x*camp, node.getChildByName("skill").scale.y, node.getChildByName("skill").scale.z);
node.getChildByName("skill").setScale(node.getChildByName("skill").scale.x*scale, node.getChildByName("skill").scale.y, node.getChildByName("skill").scale.z);
let cskills = ecs.query(ecs.allOf(CSkillComp))
for (let index = 1; index <= 8; index++) {
if(smc.player_buffs[index].eid == 0){
@@ -45,7 +45,7 @@ export class CSkill extends ecs.Entity {
}
console.log("load skill",pos,smc.player_buffs)
node.setPosition(pos.x*-camp,pos.y,pos.z)
node.setPosition(pos.x*scale,pos.y,pos.z)
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
const url = 'game/heros/skill';
resources.load(url, SpriteAtlas, (err: any, atlas) => {
@@ -59,7 +59,7 @@ export class CSkill extends ecs.Entity {
skill_init(uuid:number=1001,node:Node,pos:Vec3=v3(0,0,0)){
var mv = node.getComponent(CSkillComp)
mv.camp = 1;
mv.scale = 1;
this.add(mv);
}

View File

@@ -1,8 +1,12 @@
import { _decorator } from "cc";
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 { Timer } from "../../../../extensions/oops-plugin-framework/assets/core/common/timer/Timer";
import { Skill } from "../skills/Skill";
import { SkillSet } from "../common/config/CardSet";
import { Monster } from "./Monster";
import { MonsterModelComp } from "./MonsterModelComp";
import { MonsterViewComp } from "./MonsterViewComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@@ -10,21 +14,47 @@ const { ccclass, property } = _decorator;
@ecs.register('CSkill', false)
export class CSkillComp extends CCComp {
//持续时间
in_time: Timer = new Timer(5)
is_destroy:boolean = false;
camp:number = 1;
private sd:Timer = new Timer(5)
private cd:Timer = new Timer(1)
private is_destroy:boolean = false;
scale:number = 1;
speed:number = 0;
dis:number = 0;
atk:number = 0;
skill_uuid:number = 1001;
/** 视图层逻辑代码分离演示 */
start() {
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
// this.on(ModuleEvent.Cmd, this.onHandler, this);
this.sd =new Timer(SkillSet[this.skill_uuid].sd)
this.cd = new Timer(SkillSet[this.skill_uuid].cd)
}
protected update(dt: number): void {
if (this.in_time.update(dt)) {
if (this.sd.update(dt)) {
if (this.is_destroy) {
return
}
this.to_destroy()
}
if (this.cd.update(dt)) {
this.shoot()
}
}
shoot() {
let skill = ecs.getEntity<Skill>(Skill);
let pos = v3(0,0)
let t_pos:Vec3=null
let monsters:any = ecs.query(ecs.allOf(MonsterModelComp));
for (const monster of monsters) {
t_pos= monster.getComponent(MonsterViewComp).get_monster_pos()
}
let scale = this.scale
let dis = SkillSet[this.skill_uuid].dis+this.dis;
let atk = SkillSet[this.skill_uuid].atk+this.atk;
let speed = SkillSet[this.skill_uuid].speed+this.speed;
let sp_name = SkillSet[this.skill_uuid].sp_name
skill.load(pos,speed,dis,scale,this.node,sp_name,atk,t_pos);
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {

View File

@@ -35,7 +35,7 @@ export class Hero extends ecs.Entity {
}
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,camp:number = 1,uuid:number=1001) {
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=1001) {
// var path = "game/monster/"+prefab_path;
var path = "game/heros/hero";
@@ -45,7 +45,7 @@ export class Hero extends ecs.Entity {
node.parent = scene.entityLayer!.node!;
// var as = node.getComponent(MonsterSpine);
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*camp, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*scale, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
node.setPosition(pos)
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
const url = 'game/heros/heros';
@@ -70,7 +70,7 @@ export class Hero extends ecs.Entity {
mv.power = smc.heros[uuid].power;
mv.type = smc.heros[uuid].type;
mv.Tpos = v3(0,0,0);
mv.camp = 1;
mv.scale = 1;
mv.change_name(smc.heros[uuid].name,1)
this.add(mv);
this.push_monsters_in(uuid,mv.ent.eid)

View File

@@ -60,7 +60,7 @@ export class HeroCard extends ecs.Entity {
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.parent = parent;
// node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*camp, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
// node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*scale, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
node.setPosition(pos)

View File

@@ -35,7 +35,7 @@ export class Monster extends ecs.Entity {
}
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,camp:number = -1,uuid:number=1001) {
load(pos: Vec3 = Vec3.ZERO,scale:number = -1,uuid:number=1001) {
// var path = "game/monster/"+prefab_path;
var path = "game/heros/hero";
@@ -45,7 +45,7 @@ export class Monster extends ecs.Entity {
node.parent = scene.entityLayer!.node!;
var as = node.getComponent(MonsterSpine);
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*camp, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*scale, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
node.setPosition(pos)
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
const url = 'game/heros/heros';
@@ -67,7 +67,7 @@ export class Monster extends ecs.Entity {
mv.atk_cd = smc.heros[uuid].atk_cd;
mv.power = smc.heros[uuid].power;
mv.type = smc.heros[uuid].type;
mv.camp = -1;
mv.scale = -1;
mv.Tpos = v3(0,0,0);
mv.change_name(smc.heros[uuid].name,-1)
this.add(mv);

View File

@@ -29,7 +29,7 @@ export class MonsterViewComp extends CCComp {
hero_uuid:number = 1001;
hero_name : string = "hero";
level:number =1;
camp: number = 1; /** 角色阵营 1hero -1 :monster */
scale: number = 1; /** 角色阵营 1hero -1 :monster */
type: number = 1; /**角色类型 1前排 2 后排 */
state: number = 1; /** 状态 1move ,2: act 3: stop */
@@ -105,12 +105,12 @@ export class MonsterViewComp extends CCComp {
// EPhysics2DDrawFlags.Joint |
// EPhysics2DDrawFlags.Shape;
}
change_name(hero_name:string='hero',camp:number=1){
change_name(hero_name:string='hero',scale:number=1){
this.name=hero_name;
let label:any =this.node.getChildByName("lab_name")
label.getComponent(Label)!.string = hero_name;
let collider = this.getComponent(Collider2D);
if(camp==1){
if(scale==1){
collider.group=BoxSet.HERO;
}else{
collider.group=BoxSet.MONSTER;
@@ -144,14 +144,17 @@ export class MonsterViewComp extends CCComp {
}
/**
* 根据角色的阵营检查角色的 x 轴位置是否满足特定条件。
* 如果角色属于正向阵营 (camp == 1) 且 x 轴位置大于等于 0则直接返回。
* 如果角色属于反向阵营 (camp != 1) 且 x 轴位置小于等于 0则直接返回。
* 如果角色属于正向阵营 (scale == 1) 且 x 轴位置大于等于 0则直接返回。
* 如果角色属于反向阵营 (scale != 1) 且 x 轴位置小于等于 0则直接返回。
*/
if ((this.camp === 1 && this.node.position.x >= 0) || (this.camp !== 1 && this.node.position.x <= -180)) {
if ((this.scale === 1 && this.node.position.x >= 0) || (this.scale !== 1 && this.node.position.x <= -180)) {
return;
}
this.node.setPosition(this.node.position.x+dt*this.speed*this.camp, this.node.position.y, this.node.position.z);
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y, this.node.position.z);
}
get_monster_pos(){
return this.node.getPosition()
}
power_change(power: number){
this.power += power;
@@ -167,7 +170,10 @@ export class MonsterViewComp extends CCComp {
this.atk_time = 0;
// console.log("atk_cd:"+this.atk_cd);
this.as.atk();
this.scheduleOnce(()=>{
this.load_skill(this.skill_name);
},0.2)
}
this.atk_time += dt;
}
@@ -200,7 +206,7 @@ export class MonsterViewComp extends CCComp {
}
}
in_destroy(){
// switch (this.camp) {
// switch (this.scale) {
// case -1:
// if(this.node.position.x < BoxSet.LETF_END){
// this.toDestroy();
@@ -223,9 +229,9 @@ export class MonsterViewComp extends CCComp {
load_skill(skill_name){
// console.log("load_skill");
let skill = ecs.getEntity<Skill>(Skill);
let pos = v3(this.camp*30,30)
let pos = v3(this.scale*30,30)
let speed =400
let scale = this.camp
let scale = this.scale
let range = 120;
skill.load(pos,speed,range,scale,this.node,skill_name,this.atk);
}

View File

@@ -28,7 +28,7 @@ export class Skill extends ecs.Entity {
this.remove(SkillCom);
super.destroy();
}
load(pos: Vec3 = Vec3.ZERO,speed:number = 100,range:number = 50,scale:number = 1,parent:Node,skill_name:string = "base",atk:number =10) {
load(pos: Vec3 = Vec3.ZERO,speed:number = 100,dis:number = 50,scale:number = 1,parent:Node,skill_name:string = "base",atk:number =10,t_pos:Vec3 = null) {
var path = "game/skills/"+skill_name;
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
@@ -39,9 +39,10 @@ export class Skill extends ecs.Entity {
var sv = node.getComponent(SkillCom)!;
sv.speed = speed;
sv.range = range;
sv.dis = dis;
sv.scale = scale;
sv.atk = atk;
sv.t_pos = t_pos;
if(scale == 1){
sv.change_collider_group(BoxSet.HERO_SKILL)
}else{

View File

@@ -1,4 +1,4 @@
import { _decorator,Collider2D ,Contact2DType,v3,IPhysics2DContact} from "cc";
import { _decorator,Collider2D ,Contact2DType,v3,IPhysics2DContact,Vec3, tween} 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";
@@ -16,9 +16,10 @@ export class SkillCom extends CCComp {
// // this.on(ModuleEvent.Cmd, this.onHandler, this);
// }
speed:number = 200;
range:number = 80;
dis:number = 80;
scale:number = 1;
atk:number = 10;
t_pos:Vec3 = null;
is_destroy:boolean = false;
start() {
this.node.active=true
@@ -27,6 +28,19 @@ export class SkillCom extends CCComp {
// collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
}
if(this.t_pos){
tween(this.node).to( 0.5,{ position: new Vec3(0, 10, 0) } ).start();
}else{
tween(this.node).to( this.dis/this.speed,
{ position: new Vec3(this.node.position.x+this.scale*this.dis,this.node.position.y) },
{
onComplete: (target?: object) => {
this.toDestroy()
},
}
).start();
}
}
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
switch (selfCollider.group) {
@@ -67,9 +81,9 @@ export class SkillCom extends CCComp {
collider.group = group;
}
update(deltaTime: number) {
this.node.setScale(v3(this.scale,this.node.scale.y,this.node.scale.z))
this.node.setPosition(v3(this.node.position.x+deltaTime*this.speed*this.scale,this.node.position.y,this.node.position.z))
if(Math.abs(this.node.position.x) > this.range)
// this.node.setScale(v3(this.scale,this.node.scale.y,this.node.scale.z))
this.move(deltaTime)
if(Math.abs(this.node.position.x) > this.dis)
{
if(this.is_destroy){
return
@@ -81,6 +95,11 @@ export class SkillCom extends CCComp {
}
}
move(dt: number) {
// this.node.setPosition(v3(this.node.position.x+dt*this.speed*this.scale,this.node.position.y,this.node.position.z))
}
/** 全局消息逻辑处理 */
// private onHandler(event: string, args: any) {
// switch (event) {