From ca0f89a1b87a69cfcd262ae40094e11b0177fd4a Mon Sep 17 00:00:00 2001 From: k8w Date: Fri, 3 Dec 2021 17:08:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/src/shared/game/GameSystem.ts | 11 ++++++++++- .../backend/src/shared/game/state/ArrowState.ts | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) 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