This commit is contained in:
k8w 2021-12-03 17:08:12 +08:00
parent 171c0264a2
commit ca0f89a1b8
2 changed files with 13 additions and 1 deletions

View File

@ -3,9 +3,13 @@ import { ArrowState } from "./state/ArrowState";
import { PlayerState } from "./state/PlayerState"; import { PlayerState } from "./state/PlayerState";
export interface GameSystemState { export interface GameSystemState {
// 当前的时间(游戏时间)
now: number, now: number,
// 玩家
players: PlayerState[], players: PlayerState[],
// 飞行中的箭矢
arrows: ArrowState[], arrows: ArrowState[],
// 箭矢的 ID 生成
nextArrowId: number nextArrowId: number
} }
@ -119,4 +123,9 @@ export interface TimePast {
type: 'TimePast', type: 'TimePast',
dt: number dt: number
} }
export type GameSystemInput = PlayerMove | PlayerAttack | PlayerJoin | PlayerLeave | TimePast;
export type GameSystemInput = PlayerMove
| PlayerAttack
| PlayerJoin
| PlayerLeave
| TimePast;

View File

@ -1,6 +1,9 @@
export type ArrowState = { export type ArrowState = {
id: number, id: number,
// 谁发出的箭
fromPlayerId: number, fromPlayerId: number,
// 落地时间(游戏时间)
targetTime: number, targetTime: number,
// 落点位置(游戏位置)
targetPos: { x: number, y: number } targetPos: { x: number, y: number }
} }