Skip to content

Commit

Permalink
Show last player when done kicking if no players left - see #328
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-blackman committed Jul 10, 2023
1 parent 474e82f commit 2777dee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion js/soccer-common/model/SoccerSceneModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ export default class SoccerSceneModel<T extends SoccerBall = SoccerBall> extends

Multilink.multilink( [ this.activeKickerIndexProperty, this.maxKicksProperty ], ( activeKickerIndex, maxKicks ) => {
this.soccerPlayers.forEach( ( soccerPlayer, index ) => {
soccerPlayer.soccerPlayerPhaseProperty.value = index === activeKickerIndex && ( index < maxKicks || !hidePlayersWhenDoneKicking ) ? SoccerPlayerPhase.READY : SoccerPlayerPhase.INACTIVE;
const showAsLastKicker = showPlayersWhenDoneKicking && ( activeKickerIndex === this.maxKicksLimit && index === activeKickerIndex - 1 );
soccerPlayer.soccerPlayerPhaseProperty.value = ( ( index === activeKickerIndex && ( index < maxKicks || showPlayersWhenDoneKicking ) ) || showAsLastKicker ) ? SoccerPlayerPhase.READY : SoccerPlayerPhase.INACTIVE;
} );
} );

Expand Down

0 comments on commit 2777dee

Please sign in to comment.