This commit is contained in:
2024-11-13 10:26:06 +08:00
parent 208e8364a8
commit 4e08ad13d1
5 changed files with 475 additions and 69 deletions

View File

@@ -23,16 +23,19 @@
}, },
{ {
"__id__": 16 "__id__": 16
},
{
"__id__": 32
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 32 "__id__": 48
} }
], ],
"_prefab": { "_prefab": {
"__id__": 34 "__id__": 50
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@@ -93,7 +96,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 5.223,
"y": 4.463, "y": 4.463,
"z": 0 "z": 0
}, },
@@ -106,7 +109,7 @@
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1, "x": 0.8,
"y": 1, "y": 1,
"z": 1 "z": 1
}, },
@@ -143,7 +146,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -30, "x": -29,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -184,8 +187,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 60, "width": 58,
"height": 9 "height": 13
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -271,7 +274,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 60, "width": 60,
"height": 10 "height": 15
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -301,9 +304,9 @@
"_dstBlendFactor": 4, "_dstBlendFactor": 4,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 255, "r": 0,
"g": 255, "g": 0,
"b": 255, "b": 0,
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
@@ -321,7 +324,7 @@
"_fillStart": 0, "_fillStart": 0,
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_useGrayscale": false, "_useGrayscale": true,
"_atlas": null, "_atlas": null,
"_id": "" "_id": ""
}, },
@@ -734,6 +737,394 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.Node",
"_name": "lv",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 33
},
{
"__id__": 39
}
],
"_active": true,
"_components": [
{
"__id__": 45
}
],
"_prefab": {
"__id__": 47
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -21.65,
"y": 3.598,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "Slider_StageHorizontal_Icon_s_Blue",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 32
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 34
},
{
"__id__": 36
}
],
"_prefab": {
"__id__": 38
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 33
},
"_enabled": true,
"__prefab": {
"__id__": 35
},
"_contentSize": {
"__type__": "cc.Size",
"width": 25,
"height": 25
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "1aGQxruLlN7o1cvpkg+w6w"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 33
},
"_enabled": true,
"__prefab": {
"__id__": 37
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@45eb2",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "dcArv4aX5BT7Q8/ryNr7JJ"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "beKxBCL4tJa7jnDk+SHSXR",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "lv",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 32
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 40
},
{
"__id__": 42
}
],
"_prefab": {
"__id__": 44
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0.514,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 39
},
"_enabled": true,
"__prefab": {
"__id__": 41
},
"_contentSize": {
"__type__": "cc.Size",
"width": 13.123046875,
"height": 27.2
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "52OiVdq2FIS6n/At5AMidd"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 39
},
"_enabled": true,
"__prefab": {
"__id__": 43
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "5",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 20,
"_fontSize": 20,
"_fontFamily": "Arial",
"_lineHeight": 20,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_enableOutline": true,
"_outlineColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_outlineWidth": 1,
"_enableShadow": false,
"_shadowColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_shadowOffset": {
"__type__": "cc.Vec2",
"x": 2,
"y": 2
},
"_shadowBlur": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "b1u114cQ9GVYzdhfy3Rypl"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "55ouENuiVCq5y534ATba9s",
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 32
},
"_enabled": true,
"__prefab": {
"__id__": 46
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "b6cy/O3+BPhoEbdec7aStO"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "02WqvhZKlNPKIWBWcAe/Nq",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@@ -744,7 +1135,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 33 "__id__": 49
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@@ -771,7 +1162,6 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "5fqU0L3/FOhKaco5UkHuWT", "fileId": "5fqU0L3/FOhKaco5UkHuWT",
"instance": null, "instance": null
"targetOverrides": null
} }
] ]

View File

@@ -1,8 +1,9 @@
export const HeroSet = { export const HeroSet = {
9001: { 9001: {
uuid: 9001, path: "k1", type: 1, level: 1,cost:2, name: "白骑士", atk: 10, hp: 100, atk_dis: 100, atk_cd: 1, power: 0, power_max: 15, speed: 40, uuid: 9001, path: "k1", type: 1, level: 1,cost:2, name: "白骑士",
skill_uuid: 9001, max_skill_uuid: 2002, atktype: 1, atk: 10, hp: 100, atk_dis: 100, atk_cd: 1, power: 0, power_max: 15, speed: 40,
sk1: 9001, sk2: 2002, sk3: 9001, sk4: 2002, sk5: 9001, sk6: 2002, atktype: 1,
}, },

View File

@@ -73,15 +73,19 @@ export class Hero extends ecs.Entity {
let talents=Talents; let talents=Talents;
hv.scale = scale; hv.scale = scale;
hv.box_group = box_group; hv.box_group = box_group;
hv.speed =hv.ospeed = hero_set.speed;
hv.hero_uuid= uuid; hv.hero_uuid= uuid;
hv.hero_name= hero_set.name; hv.hero_name= hero_set.name;
hv.speed =hv.ospeed = hero_set.speed;
hv.atk_dis = hero_set.atk_dis; hv.atk_dis = hero_set.atk_dis;
hv.power = hero_set.power; hv.power = hero_set.power;
hv.level = hero_set.level; hv.level = hero_set.level;
hv.type = hero_set.type; hv.type = hero_set.type;
hv.skill_uuid = hero_set.skill_uuid; hv.sk1 = hero_set.sk1;
hv.max_skill_uuid = hero_set.max_skill_uuid; hv.sk2 = hero_set.sk2;
hv.sk3 = hero_set.sk3;
hv.sk4 = hero_set.sk4;
hv.sk5 = hero_set.sk5;
hv.role_heros_index = index; hv.role_heros_index = index;
hv.type = hero_set.type; hv.type = hero_set.type;
hv.hp= hv.hp_max =hero_set.hp; hv.hp= hv.hp_max =hero_set.hp;

View File

@@ -37,20 +37,28 @@ export class HeroViewComp extends CCComp {
@property(Material) @property(Material)
atkMaterial: Material; atkMaterial: Material;
// @property(Node)
// BoxRang:Node =null!
is_role:boolean = false;
enemy_pos:Vec3=null!; enemy_pos:Vec3=null!;
enemy:any=null!; enemy:any=null!;
/** 角色动画 */
as: HeroSpine = null!; as: HeroSpine = null!;
anm_timer:Timer = new Timer(2);
anm_name="idle"
status:String = "idle"
hero_uuid:number = 1001; hero_uuid:number = 1001;
hero_name : string = "hero"; hero_name : string = "hero";
level:number =1; level:number =1;
scale: number = 1; /** 角色阵营 1hero -1 :mon */ scale: number = 1; /** 角色阵营 1hero -1 :mon */
type: number = 1; /**角色类型 1前排 2 后排 */ type: number = 1; /**角色类型 1前排 2 后排 */
state: number = 1; /** 状态 1move ,2: act 3: stop */
box_group:number = BoxSet.HERO;
atk_range:number = 150;
private timer:Timer = new Timer(1); //计时器
is_dead:boolean = false; //是否摧毁
is_stop:boolean = false;
is_atking:boolean = false;
hp: number = 100; /** 血量 */ hp: number = 100; /** 血量 */
hp_max: number = 100; /** 最大血量 */ hp_max: number = 100; /** 最大血量 */
@@ -60,20 +68,29 @@ export class HeroViewComp extends CCComp {
power_max: number = 1200; /** 能量最大值 */ power_max: number = 1200; /** 能量最大值 */
power_speed: number = 1; //能量回复速度每0.1秒回复量 power_speed: number = 1; //能量回复速度每0.1秒回复量
skill_uuid:number = 9001; sk1:number = 9001;
max_skill_uuid:number = 1001; sk2:number = 1001;
sk3:number = 1001;
sk4:number = 1001;
sk5:number = 1001;
atk: number = 10; /**攻击力 */ atk: number = 10; /**攻击力 */
buff_atk: number = 0; atk_buff: number = 0;
atk_buffs:any = [];
// atk_speed: number = 1; // atk_speed: number = 1;
atk_cd: number = 1.3; /**攻击速度 攻击间隔 */ atk_cd: number = 1.3; /**攻击速度 攻击间隔 */
atk_dis: number = 80; atk_dis: number = 80;
atk_time: number = 0; /** 冷却时间 */ atk_time: number = 0; /** 冷却时间 */
st_boncus: number = 1; //技能持续时间加成 st_boncus: number = 1; //技能持续时间加成
s_boncus: number = 1; //技能效果加成 s_boncus: number = 1; //技能效果加成
speed: number = 100; /** 角色移动速度 */ speed: number = 100; /** 角色移动速度 */
ospeed: number = 100; /** 角色初始速度 */ ospeed: number = 100; /** 角色初始速度 */
Tpos: Vec3 = v3(0,-60,0); Tpos: Vec3 = v3(0,-60,0);
stop_cd: number = 0.5; /*停止倒计时*/ stop_cd: number = 0.5; /*停止倒计时*/
//暴击 //暴击
crit: number = 1.5; crit: number = 1.5;
crit_rate: number = 0; crit_rate: number = 0;
@@ -84,22 +101,13 @@ export class HeroViewComp extends CCComp {
shield_max:number = 200; shield_max:number = 200;
shield_time:number = 0; //护盾持续时间 shield_time:number = 0; //护盾持续时间
box_group:number = BoxSet.HERO;
atk_range:number = 150;
private timer:Timer = new Timer(1); //计时器
private m_timer:Timer = new Timer(0.1);
is_dead:boolean = false; //是否摧毁
is_stop:boolean = false;
is_atking:boolean = false;
buff_shields:any=[]; buff_shields:any=[];
buff_atks:any = [];
dir_y:number = 0; dir_y:number = 0;
speek_time:number = 0; speek_time:number = 0;
role_heros_index:number = -1; role_heros_index:number = -1;
anm_timer:Timer = new Timer(2);
anm_name="idle"
status:String = "idle"
onLoad() { onLoad() {
this.as = this.getComponent(HeroSpine); this.as = this.getComponent(HeroSpine);
// this.BoxRang = this.node.getChildByName("range_box"); // this.BoxRang = this.node.getChildByName("range_box");
@@ -109,16 +117,21 @@ export class HeroViewComp extends CCComp {
start () { start () {
this.as.move() this.as.move()
this.node.getChildByName("top").getChildByName("hp").active = false; /** 方向 */
this.sprite = this.node.getChildByName("anm").getComponent(Sprite);
this.node.setScale(this.scale,1); this.node.setScale(this.scale,1);
this.node.getChildByName("top").setScale(this.scale,1);
/** 显示角色血量 */
this.node.getChildByName("top").getChildByName("hp").active = true;
/** 闪光特效 */
this.sprite = this.node.getChildByName("anm").getComponent(Sprite);
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
// this.node.getChildByName("top").getChildByName("shield").active = false; // this.node.getChildByName("top").getChildByName("shield").active = false;
// this.node.getChildByName("top").setScale(this.scale,1); // this.node.getChildByName("top").setScale(this.scale,1);
// this.node.getChildByName("atk").setScale(this.scale,1); // this.node.getChildByName("atk").setScale(this.scale,1);
// this.node.getChildByName("atk").getComponent(Label).string = this.atk.toString(); // this.node.getChildByName("atk").getComponent(Label).string = this.atk.toString();
// this.node.getChildByName("hp_max").setScale(this.scale,1); // this.node.getChildByName("hp_max").setScale(this.scale,1);
// this.node.getChildByName("hp_max").getComponent(Label).string=this.hp_max.toString(); // this.node.getChildByName("hp_max").getComponent(Label).string=this.hp_max.toString();
this.orginalFlashMaterial = this.sprite.getRenderMaterial(0);
// this.BoxRang.getComponent(BoxRangComp).box_group = this.box_group; // this.BoxRang.getComponent(BoxRangComp).box_group = this.box_group;
// this.BoxRang.getComponent(BoxRangComp).atk_range = this.atk_range // this.BoxRang.getComponent(BoxRangComp).atk_range = this.atk_range
// this.BoxRang.getComponent(BoxRangComp).offset_x = 300; // this.BoxRang.getComponent(BoxRangComp).offset_x = 300;
@@ -126,6 +139,7 @@ export class HeroViewComp extends CCComp {
// console.log("monseter ",this.BoxRang); // console.log("monseter ",this.BoxRang);
// 注册单个碰撞体的回调函数 // 注册单个碰撞体的回调函数
let collider = this.getComponent(Collider2D); let collider = this.getComponent(Collider2D);
collider.group = this.box_group; collider.group = this.box_group;
console.log("hero collider ",this.scale,collider); console.log("hero collider ",this.scale,collider);
@@ -135,7 +149,6 @@ export class HeroViewComp extends CCComp {
collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this); collider.on(Contact2DType.PRE_SOLVE, this.onPreSolve, this);
// collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this); // collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
} }
// this.node.getChildByName("level").getChildByName("level").getComponent(Label).string = this.level.toString();
} }
@@ -203,13 +216,13 @@ export class HeroViewComp extends CCComp {
// this.change_anm() // this.change_anm()
// } // }
this.in_destroy(); this.in_destroy();
this.check_buff_atks(dt) this.check_atk_buffs(dt)
this.in_shield(dt); this.in_shield(dt);
this.in_stop(dt); this.in_stop(dt);
this.atk_time += dt; this.atk_time += dt;
this.check_enemy_alive() this.check_enemy_alive()
this.in_atk(dt); this.in_atk(dt);
this.hp_show() // this.hp_show()
this.move(dt); this.move(dt);
@@ -315,9 +328,9 @@ export class HeroViewComp extends CCComp {
this.power += power; this.power += power;
if(this.power >= this.power_max){ if(this.power >= this.power_max){
this.as.atk() this.as.atk()
// this.to_speek(smc.skills[this.max_skill_uuid].name) // this.to_speek(smc.skills[this.sk2].name)
this.scheduleOnce(()=>{ this.scheduleOnce(()=>{
this.handle_skill(this.max_skill_uuid); this.handle_skill(this.sk2);
},0.5) },0.5)
this.power = 0 this.power = 0
} }
@@ -346,24 +359,24 @@ export class HeroViewComp extends CCComp {
return {pos,t_pos} return {pos,t_pos}
} }
shoot_enemy(skill_uuid:number,y:number=0,x:number=0){ shoot_enemy(sk1:number,y:number=0,x:number=0){
// console.log("mon shoot_enemy"); // console.log("mon shoot_enemy");
let skill = ecs.getEntity<Skill>(Skill); let skill = ecs.getEntity<Skill>(Skill);
let increase_atk=Math.floor(this.atk*smc.vm_data.mission.hero.atk) let increase_atk=Math.floor(this.atk*smc.vm_data.mission.hero.atk)
let atk = smc.skills[skill_uuid].atk+this.buff_atk+increase_atk; let atk = smc.skills[sk1].atk+this.atk_buff+increase_atk;
let {pos,t_pos}=this.get_enemy_pos() let {pos,t_pos}=this.get_enemy_pos()
pos.y=pos.y + y pos.y=pos.y + y
pos.x=pos.x + x pos.x=pos.x + x
skill.load(pos,this.box_group,this.node,skill_uuid,atk,t_pos); skill.load(pos,this.box_group,this.node,sk1,atk,t_pos);
console.log(this.scale+this.hero_name+"使用技能:"+skill_uuid); console.log(this.scale+this.hero_name+"使用技能:"+sk1);
// this.tooltip(3,smc.skills[skill_uuid].name,this.skill_uuid); // this.tooltip(3,smc.skills[sk1].name,this.sk1);
} }
to_add_buff(hero:any,s_uuid:number){ to_add_buff(hero:any,s_uuid:number){
let skill = ecs.getEntity<Skill>(Skill); let skill = ecs.getEntity<Skill>(Skill);
let atk = smc.skills[s_uuid].atk+this.atk; let atk = smc.skills[s_uuid].atk+this.atk;
let {pos,t_pos}=this.get_hero_pos(hero) let {pos,t_pos}=this.get_hero_pos(hero)
skill.load(pos,this.box_group,this.node,this.max_skill_uuid,atk,t_pos); skill.load(pos,this.box_group,this.node,this.sk2,atk,t_pos);
if(smc.skills[s_uuid].hp > 0){ //buff加血 if(smc.skills[s_uuid].hp > 0){ //buff加血
let increase_hp=Math.floor(smc.skills[s_uuid].hp*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk) let increase_hp=Math.floor(smc.skills[s_uuid].hp*this.atk*this.s_boncus*smc.vm_data.mission.hero.atk)
hero.add_hp(increase_hp) hero.add_hp(increase_hp)
@@ -464,7 +477,7 @@ export class HeroViewComp extends CCComp {
console.log("atk_cd:"+this.atk_cd); console.log("atk_cd:"+this.atk_cd);
this.as.atk(); this.as.atk();
this.scheduleOnce(()=>{ this.scheduleOnce(()=>{
this.handle_skill(this.skill_uuid) this.handle_skill(this.sk1)
},0.4) },0.4)
} }
} }
@@ -524,29 +537,29 @@ export class HeroViewComp extends CCComp {
} }
add_atk(atk: number,time:number=0){ add_atk(atk: number,time:number=0){
if(time > 0){ if(time > 0){
this.buff_atk=0 this.atk_buff=0
let buff={atk:atk,time:time} let buff={atk:atk,time:time}
this.buff_atks.push(buff); this.atk_buffs.push(buff);
this.buff_atks.forEach((element: { atk: number; }) => { this.atk_buffs.forEach((element: { atk: number; }) => {
this.buff_atk += element.atk this.atk_buff += element.atk
}); });
}else{ }else{
this.atk += atk; this.atk += atk;
} }
// console.log(this.buff_atks) // console.log(this.atk_buffs)
} }
check_buff_atks(dt: number){ check_atk_buffs(dt: number){
for(let i=0;i<this.buff_atks.length;i++){ for(let i=0;i<this.atk_buffs.length;i++){
let buff=this.buff_atks[i]; let buff=this.atk_buffs[i];
buff.time -= dt; buff.time -= dt;
if(buff.time <= 0){ if(buff.time <= 0){
this.buff_atk -= buff.atk this.atk_buff -= buff.atk
this.buff_atks.splice(i,1); this.atk_buffs.splice(i,1);
} }
} }
if(this.buff_atks.length <= 0){ if(this.atk_buffs.length <= 0){
this.buff_atk = 0 this.atk_buff = 0
// this.buff_icon_change("atk",false) // this.buff_icon_change("atk",false)
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0); this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
}else{ }else{

View File

@@ -193,7 +193,6 @@ export class MapMonsterComp extends CCComp {
let mon:any = monsters[i].HeroView.node.position let mon:any = monsters[i].HeroView.node.position
smc.enemy_pos[i].x= mon.x smc.enemy_pos[i].x= mon.x
} }
console.log("count_mon_pos",smc.enemy_pos);
} }
count_hero_pos(){ count_hero_pos(){
let heros:any= ecs.query(ecs.allOf(HeroModelComp)); let heros:any= ecs.query(ecs.allOf(HeroModelComp));
@@ -202,7 +201,6 @@ export class MapMonsterComp extends CCComp {
let ho:any = heros[i].HeroView.node.position let ho:any = heros[i].HeroView.node.position
smc.hero_pos[i].x= ho.x smc.hero_pos[i].x= ho.x
} }
console.log("count_hero_pos",smc.hero_pos);
} }
private on_do_add_hero(event: string, args: any) { private on_do_add_hero(event: string, args: any) {