This commit is contained in:
k8w 2021-12-03 17:34:53 +08:00
parent 9e1f7830c1
commit 6e76cb7f82

View File

@ -101,6 +101,7 @@ export class GameScene extends Component {
let playerStates = this.gameManager.state.players; let playerStates = this.gameManager.state.players;
for (let playerState of playerStates) { for (let playerState of playerStates) {
let player = this._playerInstances[playerState.id]; let player = this._playerInstances[playerState.id];
// 场景上还没有这个 Player新建之
if (!player) { if (!player) {
let node = instantiate(this.prefabPlayer); let node = instantiate(this.prefabPlayer);
this.players.addChild(node); this.players.addChild(node);
@ -113,7 +114,7 @@ export class GameScene extends Component {
} }
} }
// 自己不插值(本地预测),插值其它人 // 根据最新状态,更新 Player 表现组件
player.updateState(playerState, this.gameManager.state.now); player.updateState(playerState, this.gameManager.state.now);
} }