dd 56卡牌栏 为role 专有物品,不在有针对小兵的 卡牌技能, 小兵的强化靠role,没有驻场 技能,role 修改为多技能
This commit is contained in:
@@ -16,8 +16,7 @@ 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 { HeroSet } from "../common/config/heroSet";
|
||||
import { MonSet } from "../common/config/MonSet";
|
||||
import { HeroSet,MonSet } from "../common/config/heroSet";
|
||||
/** 角色实体 */
|
||||
@ecs.register(`Hero`)
|
||||
export class Hero extends ecs.Entity {
|
||||
@@ -83,7 +82,7 @@ export class Hero extends ecs.Entity {
|
||||
mv.power = smc.heros[uuid].power;
|
||||
mv.power_max= smc.heros[uuid].power_max;
|
||||
mv.type = smc.heros[uuid].type;
|
||||
mv.skill_uuid = 9001;
|
||||
mv.skill_uuid = smc.heros[uuid].skill_uuid;
|
||||
mv.max_skill_uuid = smc.heros[uuid].max_skill_uuid;
|
||||
mv.scale = 1;
|
||||
mv.Tpos = v3(0,0,0);
|
||||
|
||||
@@ -85,6 +85,7 @@ export class HeroViewComp extends CCComp {
|
||||
|
||||
buff_shields:any=[];
|
||||
buff_atks:any = [];
|
||||
dir_y:number = 0;
|
||||
|
||||
onLoad() {
|
||||
this.as = this.getComponent(HeroSpine);
|
||||
@@ -94,7 +95,7 @@ export class HeroViewComp extends CCComp {
|
||||
start () {
|
||||
this.as.move()
|
||||
this.sprite = this.node.getChildByName("anm").getComponent(Sprite);
|
||||
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("atk").setScale(this.scale,1);
|
||||
// this.node.getChildByName("atk").getComponent(Label).string = this.atk.toString();
|
||||
@@ -173,7 +174,11 @@ export class HeroViewComp extends CCComp {
|
||||
if(this.enemy){
|
||||
return
|
||||
}
|
||||
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y, this.node.position.z);
|
||||
this.set_diry()
|
||||
this.node.setPosition(this.node.position.x+dt*this.speed*this.scale, this.node.position.y+dt*this.dir_y, this.node.position.z);
|
||||
}
|
||||
set_diry(){
|
||||
this.dir_y=-(this.node.position.y-BoxSet.GAME_LINE)/60
|
||||
}
|
||||
move_to(){
|
||||
var move = this.ent.get(MoveToComp) || this.ent.add(MoveToComp);
|
||||
@@ -221,10 +226,10 @@ export class HeroViewComp extends CCComp {
|
||||
},0.5)
|
||||
this.power = 0
|
||||
}
|
||||
let power_progress= this.power/this.power_max;
|
||||
this.node.getChildByName("top").getChildByName("power").getComponent(ProgressBar)!.progress = power_progress;
|
||||
// let power_progress= this.power/this.power_max;
|
||||
// this.node.getChildByName("top").getChildByName("power").getComponent(ProgressBar)!.progress = power_progress;
|
||||
}
|
||||
shoot(skill_uuid:number){
|
||||
shoot(skill_uuid:number,y:number=0){
|
||||
// console.log("mon shoot");
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let scale = this.scale
|
||||
@@ -232,11 +237,19 @@ export class HeroViewComp extends CCComp {
|
||||
let dis = smc.skills[skill_uuid].dis;
|
||||
let atk = smc.skills[skill_uuid].atk+this.atk;
|
||||
let {pos,angle,t_pos}=this.get_enemy_pos()
|
||||
pos.y=pos.y + y
|
||||
skill.load(pos,speed,dis,scale,this.node,skill_uuid,atk,angle,t_pos);
|
||||
// this.tooltip(3,smc.skills[skill_uuid].name,this.skill_uuid);
|
||||
}
|
||||
//使用max_skill
|
||||
do_max_skill(){
|
||||
if(this.max_skill_uuid==this.skill_uuid){
|
||||
this.shoot(this.max_skill_uuid,10)
|
||||
this.shoot(this.max_skill_uuid,0)
|
||||
this.shoot(this.max_skill_uuid,-10)
|
||||
return
|
||||
}
|
||||
|
||||
let skill = ecs.getEntity<Skill>(Skill);
|
||||
let scale = this.scale
|
||||
let speed =smc.skills[this.max_skill_uuid].speed;
|
||||
@@ -255,7 +268,7 @@ export class HeroViewComp extends CCComp {
|
||||
console.log("move_to",this.enemy.isValid);
|
||||
return
|
||||
}
|
||||
t_pos = v3(this.enemy.position.x-(this.node.position.x+pos.x),this.enemy.position.y-(this.node.position.y+pos.y)+BoxSet.ATK_Y)
|
||||
t_pos = v3(this.enemy.position.x-(this.node.position.x),this.enemy.position.y-(this.node.position.y+pos.y)+BoxSet.ATK_Y)
|
||||
angle = Math.atan2(t_pos.y,t_pos.x) * 180 / Math.PI;
|
||||
if(this.scale == -1){
|
||||
angle = angle +180
|
||||
@@ -373,16 +386,16 @@ export class HeroViewComp extends CCComp {
|
||||
if(this.shield_time <= 0){
|
||||
this.shield_time = 0;
|
||||
this.shield = this.shield_max=0;
|
||||
this.node.getChildByName("top").getChildByName("shield").active=false
|
||||
// this.node.getChildByName("top").getChildByName("shield").active=false
|
||||
}
|
||||
let shield_progress= this.shield/this.shield_max;
|
||||
this.node.getChildByName("top").getChildByName("shield").getComponent(ProgressBar)!.progress = shield_progress;
|
||||
// let shield_progress= this.shield/this.shield_max;
|
||||
// this.node.getChildByName("top").getChildByName("shield").getComponent(ProgressBar)!.progress = shield_progress;
|
||||
}
|
||||
if(this.shield <= 0){
|
||||
this.shield_time=0
|
||||
this.node.getChildByName("top").getChildByName("shield").active=false
|
||||
// this.node.getChildByName("top").getChildByName("shield").active=false
|
||||
}else{
|
||||
this.node.getChildByName("top").getChildByName("shield").active=true
|
||||
// this.node.getChildByName("top").getChildByName("shield").active=true
|
||||
}
|
||||
}
|
||||
tooltip(type:number=1,value:string="",s_uuid:number=1001,y:number=60){
|
||||
@@ -405,36 +418,21 @@ export class HeroViewComp extends CCComp {
|
||||
}
|
||||
}
|
||||
in_destroy(){
|
||||
// switch (this.scale) {
|
||||
// case -1:
|
||||
// if(this.node.position.x < BoxSet.LETF_END){
|
||||
// this.toDestroy();
|
||||
// }
|
||||
// break;
|
||||
// case 1:
|
||||
// if(this.node.position.x > BoxSet.RIGHT_END){
|
||||
// this.toDestroy();
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
in_atked() {
|
||||
if(this.is_role){
|
||||
var path = "game/skills/atked";
|
||||
var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
var node = instantiate(prefab);
|
||||
let pos = v3(0,60)
|
||||
node.setPosition(pos)
|
||||
node.parent = this.node;
|
||||
// var path = "game/skills/atked";
|
||||
// var prefab: Prefab = oops.res.get(path, Prefab)!;
|
||||
// var node = instantiate(prefab);
|
||||
// let pos = v3(0,60)
|
||||
// node.setPosition(pos)
|
||||
// node.parent = this.node;
|
||||
this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
|
||||
this.scheduleOnce(() => {
|
||||
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
}, 0.1);
|
||||
|
||||
}else{
|
||||
this.sprite.setSharedMaterial(this.hitFlashMaterial, 0);
|
||||
this.scheduleOnce(() => {
|
||||
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
|
||||
}, 0.1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
dead(){
|
||||
|
||||
Reference in New Issue
Block a user