mirror of
https://github.com/kirikayakazuto/CocosCreator_ECS
synced 2025-10-30 19:05:52 +00:00
ECS Demo
This commit is contained in:
6
assets/Script/Struct/Direction.ts
Normal file
6
assets/Script/Struct/Direction.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export enum Direction {
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
10
assets/Script/Struct/Direction.ts.meta
Normal file
10
assets/Script/Struct/Direction.ts.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "436daff0-c505-45e0-b0ea-d804b6ef7fac",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
59
assets/Script/Struct/NodeEvent.ts
Normal file
59
assets/Script/Struct/NodeEvent.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
10
assets/Script/Struct/NodeEvent.ts.meta
Normal file
10
assets/Script/Struct/NodeEvent.ts.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "8bdaf2f1-e01a-449c-88ab-e35aa4741b9c",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
Reference in New Issue
Block a user