mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
added sounds to moving
This commit is contained in:
parent
bc4e7ab662
commit
8f9ca32a2b
1 changed files with 28 additions and 0 deletions
|
@ -23,6 +23,8 @@
|
||||||
this.rotateOverlayCurrent = null;
|
this.rotateOverlayCurrent = null;
|
||||||
this.rotateMode = false;
|
this.rotateMode = false;
|
||||||
this.originalRotation = null;
|
this.originalRotation = null;
|
||||||
|
this.sound = null;
|
||||||
|
this.injector = null;
|
||||||
|
|
||||||
var rotateOverlayTargetSize = 10000; // really big target
|
var rotateOverlayTargetSize = 10000; // really big target
|
||||||
var innerSnapAngle = 22.5; // the angle which we snap to on the inner rotation tool
|
var innerSnapAngle = 22.5; // the angle which we snap to on the inner rotation tool
|
||||||
|
@ -34,7 +36,28 @@
|
||||||
var yawNormal;
|
var yawNormal;
|
||||||
|
|
||||||
var debug = true;
|
var debug = true;
|
||||||
|
|
||||||
|
// Download sound if needed
|
||||||
|
this.maybeDownloadSound = function() {
|
||||||
|
if (this.sound === null) {
|
||||||
|
this.sound = SoundCache.getSound("http://public.highfidelity.io/sounds/Collisions-otherorganic/whoosh2.raw");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Play drag sound
|
||||||
|
this.playSound = function() {
|
||||||
|
this.stopSound();
|
||||||
|
if (this.sound && this.sound.downloaded) {
|
||||||
|
this.injector = Audio.playSound(this.sound, { position: this.properties.position, loop: true, volume: 0.1 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// stop drag sound
|
||||||
|
this.stopSound = function() {
|
||||||
|
if (this.injector) {
|
||||||
|
Audio.stopInjector(this.injector);
|
||||||
|
this.injector = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Pr, Vr are respectively the Ray's Point of origin and Vector director
|
// Pr, Vr are respectively the Ray's Point of origin and Vector director
|
||||||
// Pp, Np are respectively the Plane's Point of origin and Normal vector
|
// Pp, Np are respectively the Plane's Point of origin and Normal vector
|
||||||
|
@ -66,6 +89,9 @@
|
||||||
|
|
||||||
this.move = function(mouseEvent) {
|
this.move = function(mouseEvent) {
|
||||||
this.updatePosition(mouseEvent);
|
this.updatePosition(mouseEvent);
|
||||||
|
if (this.injector === null) {
|
||||||
|
this.playSound();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.release = function(mouseEvent) {
|
this.release = function(mouseEvent) {
|
||||||
|
@ -234,6 +260,7 @@
|
||||||
|
|
||||||
this.preload = function(entityID) {
|
this.preload = function(entityID) {
|
||||||
this.updateProperties(entityID); // All callbacks start by updating the properties
|
this.updateProperties(entityID); // All callbacks start by updating the properties
|
||||||
|
this.maybeDownloadSound();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.clickDownOnEntity = function(entityID, mouseEvent) {
|
this.clickDownOnEntity = function(entityID, mouseEvent) {
|
||||||
|
@ -289,6 +316,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.firstHolding = false;
|
this.firstHolding = false;
|
||||||
|
this.stopSound();
|
||||||
};
|
};
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue