mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix more memory leak
This commit is contained in:
parent
3eb5c33660
commit
f6bde8a837
6 changed files with 42 additions and 3 deletions
|
|
@ -1545,6 +1545,8 @@ class DtsObject extends GameObject {
|
||||||
public override function dispose() {
|
public override function dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
this.level = null;
|
this.level = null;
|
||||||
|
boundingCollider = null;
|
||||||
|
colliders = null;
|
||||||
this.dtsResource.release();
|
this.dtsResource.release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -449,8 +449,7 @@ class Marble extends GameObject {
|
||||||
|
|
||||||
if (isUltra) {
|
if (isUltra) {
|
||||||
this.rollMegaSound = AudioManager.playSound(ResourceLoader.getResource("data/sound/mega_roll.wav", ResourceLoader.getAudio,
|
this.rollMegaSound = AudioManager.playSound(ResourceLoader.getResource("data/sound/mega_roll.wav", ResourceLoader.getAudio,
|
||||||
this.soundResources), this.getAbsPos().getPosition(),
|
this.soundResources), this.getAbsPos().getPosition(), true);
|
||||||
true);
|
|
||||||
this.rollMegaSound.volume = 0;
|
this.rollMegaSound.volume = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2123,5 +2122,8 @@ class Marble extends GameObject {
|
||||||
if (this.helicopterSound != null)
|
if (this.helicopterSound != null)
|
||||||
this.helicopterSound.stop();
|
this.helicopterSound.stop();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
removeChildren();
|
||||||
|
camera = null;
|
||||||
|
collider = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1842,8 +1842,9 @@ class MarbleWorld extends Scheduler {
|
||||||
|
|
||||||
if (sky != null)
|
if (sky != null)
|
||||||
sky.dispose();
|
sky.dispose();
|
||||||
|
sky = null;
|
||||||
instanceManager = null;
|
instanceManager = null;
|
||||||
|
collisionWorld.dispose();
|
||||||
collisionWorld = null;
|
collisionWorld = null;
|
||||||
particleManager = null;
|
particleManager = null;
|
||||||
namedObjects = null;
|
namedObjects = null;
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,15 @@ class CollisionEntity implements IOctreeObject implements IBVHObject {
|
||||||
// this.bvh.build();
|
// this.bvh.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dispose() {
|
||||||
|
for (s in this.surfaces)
|
||||||
|
s.dispose();
|
||||||
|
go = null;
|
||||||
|
surfaces = null;
|
||||||
|
bvh = null;
|
||||||
|
octree = null;
|
||||||
|
}
|
||||||
|
|
||||||
public function setTransform(transform:Matrix) {
|
public function setTransform(transform:Matrix) {
|
||||||
if (this.transform.equal(transform))
|
if (this.transform.equal(transform))
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -151,4 +151,15 @@ class CollisionSurface implements IOctreeObject implements IBVHObject {
|
||||||
n: _transformedNormals[p1]
|
n: _transformedNormals[p1]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dispose() {
|
||||||
|
points = null;
|
||||||
|
normals = null;
|
||||||
|
indices = null;
|
||||||
|
_transformedPoints = null;
|
||||||
|
_transformedNormals = null;
|
||||||
|
edgeData = null;
|
||||||
|
edgeConcavities = null;
|
||||||
|
originalIndices = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,4 +131,18 @@ class CollisionWorld {
|
||||||
this.dynamicOctree.update(entity);
|
this.dynamicOctree.update(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function dispose() {
|
||||||
|
for (e in entities) {
|
||||||
|
e.dispose();
|
||||||
|
}
|
||||||
|
for (e in dynamicEntities) {
|
||||||
|
e.dispose();
|
||||||
|
}
|
||||||
|
octree = null;
|
||||||
|
entities = null;
|
||||||
|
dynamicEntities = null;
|
||||||
|
dynamicOctree = null;
|
||||||
|
dynamicEntitySet = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue