技能移动修改
This commit is contained in:
@@ -29,7 +29,7 @@ export class MonsterViewComp extends CCComp {
|
||||
hero_uuid:number = 1001;
|
||||
hero_name : string = "hero";
|
||||
level:number =1;
|
||||
camp: number = 1; /** 角色阵营 1:hero -1 :monster */
|
||||
scale: number = 1; /** 角色阵营 1:hero -1 :monster */
|
||||
type: number = 1; /**角色类型 1:前排 2 后排 */
|
||||
state: number = 1; /** 状态 1:move ,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.load_skill(this.skill_name);
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user