33 lines
797 B
TypeScript
33 lines
797 B
TypeScript
import { Command } from "@colyseus/command";
|
|
import { CardGameState } from "../schema/CardGameState";
|
|
|
|
export class DeepAsync extends Command<CardGameState> {
|
|
async execute() {
|
|
this.state.i = 0;
|
|
return [new DeepOneAsync(), new DeepOneAsync()];
|
|
}
|
|
}
|
|
|
|
export class DeepOneAsync extends Command<CardGameState> {
|
|
async execute() {
|
|
await this.delay(100);
|
|
this.state.i += 1;
|
|
return [new DeepTwoAsync()];
|
|
}
|
|
}
|
|
|
|
export class DeepTwoAsync extends Command<CardGameState> {
|
|
async execute() {
|
|
await this.delay(100);
|
|
this.state.i += 10;
|
|
return [new DeepThreeAsync()];
|
|
}
|
|
}
|
|
|
|
export class DeepThreeAsync extends Command<CardGameState> {
|
|
async execute() {
|
|
await this.delay(100);
|
|
this.state.i += 100;
|
|
}
|
|
}
|