import { _decorator, Component, easing, Label, Node, tween, Vec3 } from 'cc'; import { BattleNodeBase } from './BattleNodeBase'; import { RenderPriority } from '../data/BattleEnum'; const { ccclass, property } = _decorator; //受伤扣血 @ccclass('Hurt') export class Hurt extends BattleNodeBase { @property({ type: Label, tooltip: '血条' }) label: Label = null; protected onLoad(): void { this.priority = RenderPriority.Life; } start() { } hurt(hurt:number,onComplete:Function){ this.node.active = true; this.label.string = hurt.toFixed(0); this.label.node.qtJumpPosition(new Vec3(Math.random()*60-30, Math.random()*20+10, 0), 20, 1, 0.5,{onComplete : ()=>{ this.node.active = false; onComplete&&onComplete() }}).start() } }