Skip to content

Commit

Permalink
Improve logic on clear, see #160
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Apr 27, 2023
1 parent 6a82192 commit dda2479
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions js/common/model/CAVModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,12 @@ export default class CAVModel implements TModel {
this.numberOfScheduledSoccerBallsToKickProperty.reset();
this.timeProperty.reset();
this.timeWhenLastBallWasKickedProperty.reset();
this.activeKickerIndexProperty.reset();

this.soccerPlayers.forEach( soccerPlayer => soccerPlayer.reset() );
this.soccerBallGroup.forEach( soccerBall => soccerBall.reset() );
this.nextBallToKickProperty.value = this.soccerBallGroup[ 0 ];
this.nextBallToKickProperty.value = this.getNextBallFromPool();

this.activeKickerIndexProperty.reset();
}

/**
Expand All @@ -416,8 +417,9 @@ export default class CAVModel implements TModel {
this.isShowingPlayAreaMedianProperty.reset();
this.isShowingMeanPredictionProperty.reset();
this.isShowingMedianPredictionProperty.reset();
this.clearData();
this.distributionProperty.value = CAVModel.chooseDistribution();
this.clearData();

this.resetEmitter.emit();
}

Expand Down Expand Up @@ -569,7 +571,6 @@ export default class CAVModel implements TModel {
*/
private kickBall( soccerPlayer: SoccerPlayer, soccerBall: CAVObject ): void {
soccerPlayer.poseProperty.value = Pose.KICKING;
soccerBall.isActiveProperty.value = true;

// Test that the sampling engine is working properly
// TODO: Where should these tests live? Should it be in the unit tests? Or in dot?
Expand Down

0 comments on commit dda2479

Please sign in to comment.