Load in victory states when appropriate (#5)

master
Garrett Mills 4 years ago
parent 3b3f09d8f1
commit 60bd974314
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

@ -162,6 +162,12 @@ export default class TopLevelComponent extends Component {
this.ships_to_place = game_service.get_possible_boats()
}
if ( next_state === GameState.PlayerVictory ) {
const [victor_state, loser_state] = game_service.get_player_victory_state()
this.player_rows = victor_state
this.opponent_rows = loser_state
}
this.instructions = instructions[this.current_state]
})
}

@ -203,6 +203,11 @@ export class GameStateService {
})
}
/**
* Get the states that should be shown on the victory screen.
* First element is the winner's state, second element is the loser's state.
* @return {object[][][]}
*/
get_player_victory_state(){
return [clone(this.player_x_game_board[this.current_player]), clone(this.player_x_game_board[this.current_opponent])]
}

Loading…
Cancel
Save