Skip to content

Commit

Permalink
added sound for reset, see #148
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Nov 27, 2018
1 parent 712d04b commit 386efe0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions js/friction/model/FrictionModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ define( function( require ) {
// TODO: likely this should be removed
this.hintProperty = new BooleanProperty( true );

// @public (read-only) {BooleanProperty} - true when a reset is in progress, false otherwise
this.resetInProgressProperty = new BooleanProperty( false );

// @public {Number} (read-only) - drag and drop book coordinates conversion coefficient
this.bookDraggingScaleFactor = 0.025;

Expand Down Expand Up @@ -338,6 +341,7 @@ define( function( require ) {
* @public
*/
reset: function() {
this.resetInProgressProperty.set( true );
this.amplitudeProperty.reset();
this.topBookPositionProperty.reset();
this.distanceBetweenBooksProperty.reset();
Expand All @@ -349,6 +353,7 @@ define( function( require ) {
atom.reset();
} );
this.numberOfAtomsEvaporated = 0;
this.resetInProgressProperty.set( false );
},

/**
Expand Down
8 changes: 7 additions & 1 deletion js/friction/view/FrictionScreenView.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ define( function( require ) {
const MagnifierNode = require( 'FRICTION/friction/view/magnifier/MagnifierNode' );
const PlayAreaNode = require( 'SCENERY_PHET/accessibility/nodes/PlayAreaNode' );
const ResetAllButton = require( 'SCENERY_PHET/buttons/ResetAllButton' );
const ResetAllSoundGenerator = require( 'TAMBO/sound-generators/ResetAllSoundGenerator' );
const ScreenView = require( 'JOIST/ScreenView' );
const soundManager = require( 'TAMBO/soundManager' );
const TemperatureDecreasingDescriber = require( 'FRICTION/friction/view/describers/TemperatureDecreasingDescriber' );
const TemperatureIncreasingDescriber = require( 'FRICTION/friction/view/describers/TemperatureIncreasingDescriber' );
const ThermometerNode = require( 'SCENERY_PHET/ThermometerNode' );
Expand All @@ -33,7 +35,6 @@ define( function( require ) {
const chemistryString = require( 'string!FRICTION/chemistry' );
const physicsString = require( 'string!FRICTION/physics' );


// constants
const THERMOMETER_FLUID_MAIN_COLOR = 'rgb(237,28,36)';
const THERMOMETER_FLUID_HIGHLIGHT_COLOR = 'rgb(240,150,150)';
Expand Down Expand Up @@ -136,6 +137,11 @@ define( function( require ) {
} );
this.addChild( resetAllButton );

// add sound generator for reset
soundManager.addSoundGenerator( new ResetAllSoundGenerator( model.resetInProgressProperty, {
initialOutputLevel: 0.7
} ) );

let controlAreaNode = new ControlAreaNode();
this.addChild( controlAreaNode );
controlAreaNode.accessibleOrder = [ resetAllButton ];
Expand Down

0 comments on commit 386efe0

Please sign in to comment.