战斗暴击 闪避 基本完成

This commit is contained in:
walkpan
2024-11-17 19:08:21 +08:00
parent 75d2dd5988
commit 49e5447234
10 changed files with 552 additions and 93 deletions

View File

@@ -29,9 +29,8 @@ export class Skill extends ecs.Entity {
this.remove(SkillCom);
super.destroy();
}
load(pos: Vec3 = Vec3.ZERO,group:number,parent:Node,
uuid:number=1001,atk:number =10,t_pos:Vec3 = null,dis:number=0,)
load(pos: Vec3 = Vec3.ZERO,group:number,parent:Node,uuid:number=1001,
ap:number =10,t_pos:Vec3 = null,is_crit:boolean=false,crit_add:number=0)
{
var path = "game/skills/"+smc.skills[uuid].sp_name;
var prefab: Prefab = oops.res.get(path, Prefab)!;
@@ -56,11 +55,13 @@ export class Skill extends ecs.Entity {
sv.angle = angle;
// console.log(smc.skills[uuid].name+"angle:"+angle)
sv.s_uuid = uuid;
sv.atk = atk;
sv.ap = ap;
sv.is_crit=is_crit
sv.crit_add=crit_add
// node.setScale(v3(node.scale.x*scale,node.scale.y))
sv.speed=smc.skills[uuid].speed;
sv.dis=smc.skills[uuid].dis+dis;
sv.dis=smc.skills[uuid].dis;
sv.run_type=smc.skills[uuid].run;
if(sv.dis == 0){
sv.run_type=2

View File

@@ -26,8 +26,10 @@ export class SkillCom extends CCComp {
x_speed:number = 0;
dis:number = 80;
scale:number = 1;
atk:number = 10;
ap:number = 10;
atk_count:number = 0;
is_crit:boolean = false;
crit_add: number = 0;//暴击伤害加成
angle:number = 0;
t_pos:Vec3 = v3(0,0,0); // 目标增量
is_destroy:boolean = false;

View File

@@ -35,13 +35,16 @@ export class Tooltip extends ecs.Entity {
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.parent = parent;
if(parent.scale.x < 0){
node.setScale(-node.scale.x, node.scale.y, 0);
}
node.setPosition(pos)
var sv = node.getComponent(TooltipCom)!;
// console.log("load tooltip type",type,vaule,s_uuid);
sv.stype = type;
sv.value = vaule;
sv.s_uuid = s_uuid;
sv.alive_time = 0.3;
sv.alive_time = 0.5;
this.add(sv)
}
}

View File

@@ -22,10 +22,8 @@ export class TooltipCom extends CCComp {
s_uuid:number = 1001;
alive_time:number = 0.2;
skill_name_time=0.5;
scale:number = 1;
start() {
this.node.getChildByName("loss_life").active=false;
this.node.getChildByName("add_life").active=false
this.node.getChildByName("skill").active=false;
// console.log("TooltipView start",this.node);
switch(this.stype){
case 1:
@@ -33,7 +31,7 @@ export class TooltipCom extends CCComp {
this.node.getChildByName("loss_life").active=true;
tween(this.node).to(
this.alive_time,
{position:v3(this.node.position.x+30,this.node.position.y+20), },
{position:v3(this.node.position.x-10,this.node.position.y+20), },
{
onComplete:()=>{ this.ent.destroy()},
easing:"linear"
@@ -53,20 +51,45 @@ export class TooltipCom extends CCComp {
).start()
break
case 3:
this.node.getChildByName("skill").getChildByName("name").getComponent(Label).string = smc.skills[this.s_uuid].name;
this.node.getChildByName("skill").active=true;
this.node.setPosition(v3(this.node.position.x,this.node.position.y+60))
// this.alive_time = 2
tween(this.node).to(
this.alive_time,
{position:v3(this.node.position.x,this.node.position.y), },
{position:v3(this.node.position.x,this.node.position.y+30), },
{
onComplete:()=>{ this.ent.destroy()},
easing:"linear"
}
).start()
break
case 4:
this.node.getChildByName("bloss").getChildByName("hp").getComponent(Label).string = this.value;
this.node.getChildByName("bloss").active=true;
tween(this.node).to(
this.alive_time,
{position:v3(this.node.position.x-10,this.node.position.y+20), },
{
onComplete:()=>{ this.ent.destroy()},
easing:"linear"
}
).start()
break
case 5:
this.node.getChildByName("skill").getChildByName("name").getComponent(Label).string = this.value;
this.node.getChildByName("skill").active=true;
this.node.setPosition(v3(this.node.position.x,this.node.position.y+60))
// this.alive_time = 2
tween(this.node).to(
this.alive_time,
{position:v3(this.node.position.x-20,this.node.position.y+30), },
{
onComplete:()=>{ this.ent.destroy()},
easing:"linear"
}
).start()
break
}
}
@@ -77,9 +100,6 @@ export class TooltipCom extends CCComp {
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.getChildByName("loss_life").active=false;
this.node.getChildByName("add_life").active=false;
this.node.getChildByName("skill").active=false;
this.node.destroy();
}
}