diff --git a/examples/cocos-creator-multiplayer/backend/src/shared/game/GameSystem.ts b/examples/cocos-creator-multiplayer/backend/src/shared/game/GameSystem.ts index b90dd89..516a158 100644 --- a/examples/cocos-creator-multiplayer/backend/src/shared/game/GameSystem.ts +++ b/examples/cocos-creator-multiplayer/backend/src/shared/game/GameSystem.ts @@ -3,9 +3,13 @@ import { ArrowState } from "./state/ArrowState"; import { PlayerState } from "./state/PlayerState"; export interface GameSystemState { + // 当前的时间(游戏时间) now: number, + // 玩家 players: PlayerState[], + // 飞行中的箭矢 arrows: ArrowState[], + // 箭矢的 ID 生成 nextArrowId: number } @@ -119,4 +123,9 @@ export interface TimePast { type: 'TimePast', dt: number } -export type GameSystemInput = PlayerMove | PlayerAttack | PlayerJoin | PlayerLeave | TimePast; \ No newline at end of file + +export type GameSystemInput = PlayerMove + | PlayerAttack + | PlayerJoin + | PlayerLeave + | TimePast; \ No newline at end of file diff --git a/examples/cocos-creator-multiplayer/backend/src/shared/game/state/ArrowState.ts b/examples/cocos-creator-multiplayer/backend/src/shared/game/state/ArrowState.ts index b2d9531..42493d8 100644 --- a/examples/cocos-creator-multiplayer/backend/src/shared/game/state/ArrowState.ts +++ b/examples/cocos-creator-multiplayer/backend/src/shared/game/state/ArrowState.ts @@ -1,6 +1,9 @@ export type ArrowState = { id: number, + // 谁发出的箭 fromPlayerId: number, + // 落地时间(游戏时间) targetTime: number, + // 落点位置(游戏位置) targetPos: { x: number, y: number } } \ No newline at end of file