Skip to content

Commit

Permalink
Do not play audio when creating soccer balls via setData, see #318
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Jun 29, 2023
1 parent 94d3c04 commit a181977
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/soccer-common/model/SoccerSceneModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ export default class SoccerSceneModel<T extends SoccerBall = SoccerBall> extends

// In fuzzing, sometimes there are no soccer balls available
if ( soccerBall ) {
this.kickBall( frontPlayer, soccerBall );
this.kickBall( frontPlayer, soccerBall, true );
this.numberOfScheduledSoccerBallsToKickProperty.value--;
}
}
Expand Down Expand Up @@ -569,7 +569,7 @@ export default class SoccerSceneModel<T extends SoccerBall = SoccerBall> extends
/**
* Select a target location for the nextBallToKick, set its velocity and mark it for animation.
*/
private kickBall( soccerPlayer: SoccerPlayer, soccerBall: T ): void {
private kickBall( soccerPlayer: SoccerPlayer, soccerBall: T, playAudio: boolean ): void {
soccerPlayer.poseProperty.value = Pose.KICKING;

const x1 = SoccerCommonQueryParameters.sameSpot ? 7 :
Expand All @@ -590,7 +590,7 @@ export default class SoccerSceneModel<T extends SoccerBall = SoccerBall> extends

soccerBall.soccerPlayer = soccerPlayer;

kickSound.play();
playAudio && kickSound.play();
}

/**
Expand All @@ -603,7 +603,7 @@ export default class SoccerSceneModel<T extends SoccerBall = SoccerBall> extends

// Iterate through data points and create the soccer balls
for ( let i = 0; i < dataPoints.length; i++ ) {
this.kickBall( this.soccerPlayers[ i ], this.soccerBalls[ i ] );
this.kickBall( this.soccerPlayers[ i ], this.soccerBalls[ i ], false );
this.soccerBalls[ i ].valueProperty.value = dataPoints[ i ];
this.soccerBalls[ i ].soccerBallPhaseProperty.value = SoccerBallPhase.STACKED;

Expand Down

0 comments on commit a181977

Please sign in to comment.