feat(hero): 添加受击闪光效果并重构相关代码
新增FlashSprite组件实现受击闪光效果 重构HeroAnmComp和HeroViewComp以支持闪光效果 更新多个英雄prefab以包含闪光材质和组件
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
import { _decorator, Animation, AnimationState, CCClass, Component, } from "cc";
|
||||
import { HeroViewComp } from "./HeroViewComp";
|
||||
import { FacSet } from "../common/config/GameSet";
|
||||
import { FlashSprite } from "./hit-flash-white/scripts/FlashSprite";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('HeroAnmComp')
|
||||
export default class HeroAnmComp extends Component{
|
||||
|
||||
fsSprite:FlashSprite = null!;
|
||||
private anmcon:any=null
|
||||
private _hasStop = true;
|
||||
private default_anim:string='Idle'
|
||||
anms:any[]=["idle","move","stun","dead","buff","atk0","atk1","atk2","max0","max1"]
|
||||
onLoad () {
|
||||
this.anmcon=this.node.getComponent(Animation)
|
||||
this.fsSprite = this.node.getComponent(FlashSprite);
|
||||
this.anmcon.on(Animation.EventType.FINISHED, this.onAnimationFinished, this);
|
||||
}
|
||||
|
||||
@@ -25,6 +27,9 @@ export default class HeroAnmComp extends Component{
|
||||
this.anmcon.play(this.default_anim)
|
||||
}
|
||||
}
|
||||
atked(){
|
||||
this.fsSprite.clickFlash();
|
||||
}
|
||||
move () {
|
||||
if(this.anmcon.getState("move").isPlaying) return
|
||||
this.anmcon.play("move")
|
||||
|
||||
Reference in New Issue
Block a user