mirror of
https://github.com/kirikayakazuto/CocosCreator_ECS
synced 2024-12-26 11:49:19 +00:00
59 lines
1.1 KiB
TypeScript
59 lines
1.1 KiB
TypeScript
export enum EventType {
|
|
Stand,
|
|
Run,
|
|
Attack,
|
|
Hurt,
|
|
HPChange,
|
|
Death
|
|
}
|
|
|
|
export class EventBase {
|
|
type: EventType;
|
|
constructor(type:number) {
|
|
this.type = type;
|
|
}
|
|
}
|
|
|
|
export class EventStand extends EventBase {
|
|
constructor() {
|
|
super(EventType.Stand);
|
|
}
|
|
}
|
|
|
|
export class EventRun extends EventBase {
|
|
constructor() {
|
|
super(EventType.Run);
|
|
}
|
|
}
|
|
|
|
export class EventAttack extends EventBase {
|
|
constructor() {
|
|
super(EventType.Attack);
|
|
}
|
|
}
|
|
|
|
export class EventHurt extends EventBase {
|
|
constructor() {
|
|
super(EventType.Hurt);
|
|
}
|
|
}
|
|
|
|
export class EventDeath extends EventBase {
|
|
callback: Function;
|
|
constructor(cb: Function) {
|
|
super(EventType.Death);
|
|
this.callback = cb;
|
|
}
|
|
}
|
|
|
|
export class EventHPChange extends EventBase {
|
|
public lastHP: number;
|
|
public nowHP: number;
|
|
public maxHP: number;
|
|
constructor(maxHP: number, lastHP: number, nowHP: number) {
|
|
super(EventType.HPChange);
|
|
this.maxHP = maxHP;
|
|
this.lastHP = lastHP;
|
|
this.nowHP = nowHP;
|
|
}
|
|
} |