diff --git a/js/common/model/CAVModel.ts b/js/common/model/CAVModel.ts index 4df46638..f479fc34 100644 --- a/js/common/model/CAVModel.ts +++ b/js/common/model/CAVModel.ts @@ -82,7 +82,7 @@ export default class CAVModel implements TModel { private readonly nextBallToKickProperty: Property; // Null if there is no more ball to kick private readonly numberOfScheduledSoccerBallsToKickProperty: NumberProperty; - public readonly numberOfRemainingKickableSoccerBallsProperty: TReadOnlyProperty; + public readonly numberOfUnkickedBallsProperty: TReadOnlyProperty; public readonly hasKickableSoccerBallsProperty: TReadOnlyProperty; private readonly timeWhenLastBallWasKickedProperty: NumberProperty; protected readonly distributionProperty: Property>; @@ -217,7 +217,7 @@ export default class CAVModel implements TModel { phetioValueType: NullableIO( ReferenceIO( CAVObject.CAVObjectIO ) ) } ); - this.numberOfRemainingKickableSoccerBallsProperty = DerivedProperty.deriveAny( [ + this.numberOfUnkickedBallsProperty = DerivedProperty.deriveAny( [ this.numberOfScheduledSoccerBallsToKickProperty, ...this.soccerBallGroup.map( soccerBall => soccerBall.valueProperty ), ...this.soccerBallGroup.map( soccerBall => soccerBall.animationModeProperty ) ], () => { @@ -232,8 +232,8 @@ export default class CAVModel implements TModel { return value; } ); - this.hasKickableSoccerBallsProperty = new DerivedProperty( [ this.numberOfRemainingKickableSoccerBallsProperty ], - numberOfRemainingKickableObjects => numberOfRemainingKickableObjects > 0 ); + this.hasKickableSoccerBallsProperty = new DerivedProperty( [ this.numberOfUnkickedBallsProperty ], + numberOfUnkickedBalls => numberOfUnkickedBalls > 0 ); this.distributionProperty = new Property( CAVModel.chooseDistribution(), { tandem: options.tandem.createTandem( 'distributionProperty' ), @@ -248,7 +248,7 @@ export default class CAVModel implements TModel { // If the soccer player that kicked that ball was still in line when the ball lands, they can leave the line now. this.advanceLine(); - if ( this.numberOfRemainingKickableSoccerBallsProperty.value > 0 && this.nextBallToKickProperty.value === null ) { + if ( this.numberOfUnkickedBallsProperty.value > 0 && this.nextBallToKickProperty.value === null ) { this.nextBallToKickProperty.value = this.getNextBallFromPool(); } } ); @@ -391,7 +391,6 @@ export default class CAVModel implements TModel { if ( frontPlayer ) { if ( this.numberOfScheduledSoccerBallsToKickProperty.value > 0 && - this.numberOfRemainingKickableSoccerBallsProperty.value > 0 && this.timeProperty.value >= this.timeWhenLastBallWasKickedProperty.value + TIME_BETWEEN_RAPID_KICKS ) { if ( this.nextBallToKickProperty.value === null ) { @@ -511,7 +510,7 @@ export default class CAVModel implements TModel { * Adds the provided number of balls to the scheduled balls to kick */ public scheduleKicks( numberOfBallsToKick: number ): void { - this.numberOfScheduledSoccerBallsToKickProperty.value += Math.min( numberOfBallsToKick, this.numberOfRemainingKickableSoccerBallsProperty.value ); + this.numberOfScheduledSoccerBallsToKickProperty.value += Math.min( numberOfBallsToKick, this.numberOfUnkickedBallsProperty.value ); } /** @@ -560,11 +559,11 @@ export default class CAVModel implements TModel { } private getNextBallFromPool(): CAVObject | null { - const newVar = this.soccerBallGroup.find( ball => !ball.isActiveProperty.value ) || null; - if ( newVar ) { - newVar.isActiveProperty.value = true; + const nextBallFromPool = this.soccerBallGroup.find( ball => !ball.isActiveProperty.value ) || null; + if ( nextBallFromPool ) { + nextBallFromPool.isActiveProperty.value = true; } - return newVar; + return nextBallFromPool; } } diff --git a/js/common/view/KickButtonGroup.ts b/js/common/view/KickButtonGroup.ts index 8987312b..03dc26fa 100644 --- a/js/common/view/KickButtonGroup.ts +++ b/js/common/view/KickButtonGroup.ts @@ -84,7 +84,7 @@ export default class KickButtonGroup extends VBox { const multiKickProperty = new NumberProperty( 5 ); const kick5PatternStringProperty = new PatternStringProperty( CenterAndVariabilityStrings.kickValuePatternStringProperty, { value: multiKickProperty } ); - model.numberOfRemainingKickableSoccerBallsProperty.link( numberOfRemainingKickableObjects => { + model.numberOfUnkickedBallsProperty.link( numberOfRemainingKickableObjects => { const value = Math.max( Math.min( numberOfRemainingKickableObjects, 5 ), 1 ); multiKickProperty.value = value; } );