This commit is contained in:
2024-11-15 10:19:56 +08:00
parent e907141580
commit 54ccaaeaeb

View File

@@ -28,12 +28,6 @@ const { ccclass, property } = _decorator;
@ccclass('HeroViewComp') // 定义为 Cocos Creator 组件 @ccclass('HeroViewComp') // 定义为 Cocos Creator 组件
@ecs.register('HeroView', false) // 定义为 ECS 组件 @ecs.register('HeroView', false) // 定义为 ECS 组件
export class HeroViewComp extends CCComp { export class HeroViewComp extends CCComp {
@property(Material)
hitFlashMaterial: Material;
orginalFlashMaterial: Material;
sprite: Sprite;
@property(Material)
atkMaterial: Material;
enemy_pos:Vec3=null!; enemy_pos:Vec3=null!;
enemy:any=null!; enemy:any=null!;
@@ -112,10 +106,7 @@ export class HeroViewComp extends CCComp {
this.node.getChildByName("top").setScale(this.scale,1); this.node.getChildByName("top").setScale(this.scale,1);
/** 显示角色血量 */ /** 显示角色血量 */
this.node.getChildByName("top").getChildByName("hp").active = true; 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("shielded").active = false; // this.node.getChildByName("shielded").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);
@@ -480,12 +471,7 @@ export class HeroViewComp extends CCComp {
heathed(){ heathed(){
this.node.getChildByName("heathed").active=true this.node.getChildByName("heathed").active=true
// var path = "game/skills/heathed";
// var prefab: Prefab = oops.res.get(path, Prefab)!;
// var node = instantiate(prefab);
// let pos = v3(0,0)
// node.setPosition(pos)
// node.parent = this.node;
} }
hp_max_add(){ hp_max_add(){
console.log("hp_max_add 动画"); console.log("hp_max_add 动画");
@@ -552,11 +538,9 @@ export class HeroViewComp extends CCComp {
} }
if(this.ap_buffs.length <= 0){ if(this.ap_buffs.length <= 0){
this.ap_buff = 0 this.ap_buff = 0
// this.buff_icon_change("atk",false)
this.sprite.setSharedMaterial(this.orginalFlashMaterial, 0);
}else{ }else{
// this.buff_icon_change("atk",true)
this.sprite.setSharedMaterial(this.atkMaterial, 0);
} }
} }