/** @format */ import {GAME_ROLE_TIP} from '../../enums/Enum' import {IBuff} from './GameInterface' export enum EventType { Enter, Stand, Run, Attack, Skill, StopSkill, HurtOrAdd, RoleTip, HPChange, Die, BuffChange, GraphicsDraw, SlowDown, BulletEjection, } export class EventBase { type: EventType constructor(type: number) { this.type = type } } export class EventEnter extends EventBase { constructor() { super(EventType.Enter) } } export class EventStand extends EventBase { constructor() { super(EventType.Stand) } } export class EventRun extends EventBase { constructor() { super(EventType.Run) } } export class EventBuffChange extends EventBase { buffs: IBuff[] addBuffs: IBuff[] removeBuffs: IBuff[] constructor(buffs: IBuff[], addBuffs: IBuff[], removeBuffs: IBuff[]) { super(EventType.BuffChange) this.buffs = buffs this.addBuffs = addBuffs this.removeBuffs = removeBuffs } } export class EventAttack extends EventBase { dir: cc.Vec2 isShoot: boolean attackScale: number //攻击速度比例值 attackIndex: number //spine攻击动作序号 constructor(dir: cc.Vec2, isShoot: boolean, attackScale: number, attackIndex: number) { super(EventType.Attack) this.dir = dir this.isShoot = isShoot this.attackScale = attackScale this.attackIndex = attackIndex } } export class EventSkill extends EventBase { castTime: number skillIndex: number constructor(castTime: number, skillIndex: number) { super(EventType.Skill) this.castTime = castTime this.skillIndex = skillIndex + 1 } } export class EventStopSkill extends EventBase { constructor() { super(EventType.StopSkill) } } export class EventHurtOrAdd extends EventBase { public changeHP: number public isCrit: boolean constructor(changeHP: number, isCrit?: boolean) { super(EventType.HurtOrAdd) this.changeHP = changeHP this.isCrit = isCrit } } export class EventRoleTip extends EventBase { public tipType: GAME_ROLE_TIP public num: number public tip: string constructor(tipType: GAME_ROLE_TIP, num: number, tip: string) { super(EventType.RoleTip) this.tipType = tipType this.num = num this.tip = tip } } export class EventDie extends EventBase { constructor() { super(EventType.Die) } } export class EventHPChange extends EventBase { public lastHP: number public nowHP: number public HP: number public lastShieldHP: number public shieldHP: number public changeTime: number constructor( HP: number, lastHP: number, nowHP: number, lastShieldHP: number, shieldHP: number, changeTime: number = 0.2, ) { super(EventType.HPChange) this.HP = HP this.lastHP = lastHP this.nowHP = nowHP this.lastShieldHP = lastShieldHP this.shieldHP = shieldHP this.changeTime = changeTime } } export class EventGraphicsDraw extends EventBase { public points: cc.Vec2[] public radius: number public color: cc.Color constructor(points: cc.Vec2[], radius?: number, color?: cc.Color) { super(EventType.GraphicsDraw) this.points = points this.radius = radius this.color = color } } export class EventSlowDown extends EventBase { public isSlow: boolean constructor(isSlow: boolean) { super(EventType.SlowDown) this.isSlow = isSlow } } export class EventBulletEjection extends EventBase { public posX: number public posY: number constructor(posX: number, posY: number) { super(EventType.BulletEjection) this.posX = posX this.posY = posY } }