Clean up bat.js

This commit is contained in:
Ryan Huffman 2015-11-09 11:35:56 -08:00
parent 38fcdc3eff
commit 278c921a50

View file

@ -9,11 +9,12 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
Script.include("pitching.js");
(function() {
Script.include("pitching.js");
var pitchingMachine = null;
this.startNearGrab = function() {
print("Started near grab!");
this.startNearGrab = this.continueNearGrab = function() {
if (!pitchingMachine) {
pitchingMachine = getOrCreatePitchingMachine();
Script.update.connect(function(dt) { pitchingMachine.update(dt); });
@ -21,16 +22,8 @@
pitchingMachine.start();
MyAvatar.shouldRenderLocally = false;
};
this.continueNearGrab = function() {
if (!pitchingMachine) {
pitchingMachine = getOrCreatePitchingMachine();
Script.update.connect(function(dt) { pitchingMachine.update(dt); });
}
pitchingMachine.start();
MyAvatar.shouldRenderLocally = false;
}
this.releaseGrab = function() {
print("Stopped near grab!");
if (pitchingMachine) {
pitchingMachine.stop();
}