mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-04-27 21:21:41 +00:00
async shape resource loading
This commit is contained in:
parent
f79a633322
commit
92d59ec1b6
9 changed files with 197 additions and 82 deletions
|
|
@ -56,8 +56,8 @@ class Main extends hxd.App {
|
||||||
});
|
});
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
Settings.init();
|
||||||
ResourceLoader.init(s2d, () -> {
|
ResourceLoader.init(s2d, () -> {
|
||||||
Settings.init();
|
|
||||||
AudioManager.init();
|
AudioManager.init();
|
||||||
AudioManager.playShell();
|
AudioManager.playShell();
|
||||||
marbleGame = new MarbleGame(s2d, s3d);
|
marbleGame = new MarbleGame(s2d, s3d);
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ import src.Marble;
|
||||||
import src.Resource;
|
import src.Resource;
|
||||||
import src.ProfilerUI;
|
import src.ProfilerUI;
|
||||||
import src.ResourceLoaderWorker;
|
import src.ResourceLoaderWorker;
|
||||||
|
import haxe.io.Path;
|
||||||
|
|
||||||
class MarbleWorld extends Scheduler {
|
class MarbleWorld extends Scheduler {
|
||||||
public var collisionWorld:CollisionWorld;
|
public var collisionWorld:CollisionWorld;
|
||||||
|
|
@ -234,16 +235,16 @@ class MarbleWorld extends Scheduler {
|
||||||
|
|
||||||
public function postInit() {
|
public function postInit() {
|
||||||
// Add the sky at the last so that cubemap reflections work
|
// Add the sky at the last so that cubemap reflections work
|
||||||
this.scene.addChild(this.sky);
|
this.playGui.init(this.scene2d, () -> {
|
||||||
|
this.scene.addChild(this.sky);
|
||||||
this._ready = true;
|
this._ready = true;
|
||||||
this.playGui.init(this.scene2d);
|
var musicFileName = 'data/sound/music/' + this.mission.missionInfo.music;
|
||||||
var musicFileName = 'data/sound/music/' + this.mission.missionInfo.music;
|
AudioManager.playMusic(ResourceLoader.getResource(musicFileName, ResourceLoader.getAudio, this.soundResources), this.mission.missionInfo.music);
|
||||||
AudioManager.playMusic(ResourceLoader.getResource(musicFileName, ResourceLoader.getAudio, this.soundResources), this.mission.missionInfo.music);
|
MarbleGame.canvas.clearContent();
|
||||||
MarbleGame.canvas.clearContent();
|
this.endPad.generateCollider();
|
||||||
this.endPad.generateCollider();
|
this.playGui.formatGemCounter(this.gemCount, this.totalGems);
|
||||||
this.playGui.formatGemCounter(this.gemCount, this.totalGems);
|
start();
|
||||||
start();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initScene(onFinish:Void->Void) {
|
public function initScene(onFinish:Void->Void) {
|
||||||
|
|
@ -331,8 +332,14 @@ class MarbleWorld extends Scheduler {
|
||||||
"sound/set.wav",
|
"sound/set.wav",
|
||||||
"sound/go.wav",
|
"sound/go.wav",
|
||||||
"sound/alarm.wav",
|
"sound/alarm.wav",
|
||||||
"sound/alarm_timeout.wav"
|
"sound/alarm_timeout.wav",
|
||||||
|
"shapes/images/glow_bounce.dts",
|
||||||
|
"shapes/images/glow_bounce.png",
|
||||||
|
"shapes/images/helicopter.dts",
|
||||||
|
"shapes/images/helicopter.jpg"
|
||||||
];
|
];
|
||||||
|
marblefiles.push(StringTools.replace(Settings.optionsSettings.marbleModel, "data/", ""));
|
||||||
|
marblefiles.push("shapes/balls/" + Settings.optionsSettings.marbleSkin + ".marble.png");
|
||||||
for (file in marblefiles) {
|
for (file in marblefiles) {
|
||||||
worker.loadFile(file);
|
worker.loadFile(file);
|
||||||
}
|
}
|
||||||
|
|
@ -917,25 +924,89 @@ class MarbleWorld extends Scheduler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addDtsObject(obj:DtsObject, onFinish:Void->Void) {
|
public function addDtsObject(obj:DtsObject, onFinish:Void->Void) {
|
||||||
obj.idInLevel = this.dtsObjects.length; // Set the id of the thing
|
function parseIfl(path:String, onFinish:Array<String>->Void) {
|
||||||
this.dtsObjects.push(obj);
|
ResourceLoader.load(path).entry.load(() -> {
|
||||||
if (obj is ForceObject) {
|
var text = ResourceLoader.fileSystem.get(path).getText();
|
||||||
this.forceObjects.push(cast obj);
|
var lines = text.split('\n');
|
||||||
}
|
var keyframes = [];
|
||||||
obj.init(cast this, () -> {
|
for (line in lines) {
|
||||||
obj.update(this.timeState);
|
line = StringTools.trim(line);
|
||||||
if (obj.useInstancing) {
|
if (line.substr(0, 2) == "//")
|
||||||
this.instanceManager.addObject(obj);
|
continue;
|
||||||
} else
|
if (line == "")
|
||||||
this.scene.addChild(obj);
|
continue;
|
||||||
for (collider in obj.colliders) {
|
|
||||||
if (collider != null)
|
|
||||||
this.collisionWorld.addEntity(collider);
|
|
||||||
}
|
|
||||||
if (obj.isBoundingBoxCollideable)
|
|
||||||
this.collisionWorld.addEntity(obj.boundingCollider);
|
|
||||||
|
|
||||||
onFinish();
|
var parts = line.split(' ');
|
||||||
|
var count = parts.length > 1 ? Std.parseInt(parts[1]) : 1;
|
||||||
|
|
||||||
|
for (i in 0...count) {
|
||||||
|
keyframes.push(parts[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onFinish(keyframes);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ResourceLoader.load(obj.dtsPath).entry.load(() -> {
|
||||||
|
var dtsFile = ResourceLoader.loadDts(obj.dtsPath);
|
||||||
|
var directoryPath = haxe.io.Path.directory(obj.dtsPath);
|
||||||
|
var texToLoad = [];
|
||||||
|
for (i in 0...dtsFile.resource.matNames.length) {
|
||||||
|
var matName = obj.matNameOverride.exists(dtsFile.resource.matNames[i]) ? obj.matNameOverride.get(dtsFile.resource.matNames[i]) : dtsFile.resource.matNames[i];
|
||||||
|
var fullNames = ResourceLoader.getFullNamesOf(directoryPath + '/' + matName).filter(x -> haxe.io.Path.extension(x) != "dts");
|
||||||
|
var fullName = fullNames.length > 0 ? fullNames[0] : null;
|
||||||
|
if (fullName != null) {
|
||||||
|
texToLoad.push(fullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var worker = new ResourceLoaderWorker(() -> {
|
||||||
|
obj.idInLevel = this.dtsObjects.length; // Set the id of the thing
|
||||||
|
this.dtsObjects.push(obj);
|
||||||
|
if (obj is ForceObject) {
|
||||||
|
this.forceObjects.push(cast obj);
|
||||||
|
}
|
||||||
|
obj.init(cast this, () -> {
|
||||||
|
obj.update(this.timeState);
|
||||||
|
if (obj.useInstancing) {
|
||||||
|
this.instanceManager.addObject(obj);
|
||||||
|
} else
|
||||||
|
this.scene.addChild(obj);
|
||||||
|
for (collider in obj.colliders) {
|
||||||
|
if (collider != null)
|
||||||
|
this.collisionWorld.addEntity(collider);
|
||||||
|
}
|
||||||
|
if (obj.isBoundingBoxCollideable)
|
||||||
|
this.collisionWorld.addEntity(obj.boundingCollider);
|
||||||
|
|
||||||
|
onFinish();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
for (texPath in texToLoad) {
|
||||||
|
if (haxe.io.Path.extension(texPath) == "ifl") {
|
||||||
|
worker.addTask(fwd -> {
|
||||||
|
parseIfl(texPath, keyframes -> {
|
||||||
|
var innerWorker = new ResourceLoaderWorker(() -> {
|
||||||
|
fwd();
|
||||||
|
});
|
||||||
|
var loadedkf = [];
|
||||||
|
for (kf in keyframes) {
|
||||||
|
if (!loadedkf.contains(kf)) {
|
||||||
|
innerWorker.loadFile(directoryPath + '/' + kf);
|
||||||
|
loadedkf.push(kf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
innerWorker.run();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
worker.loadFile(texPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
worker.run();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1077,6 +1148,8 @@ class MarbleWorld extends Scheduler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var postInited = false;
|
||||||
|
|
||||||
function asyncLoadResources() {
|
function asyncLoadResources() {
|
||||||
if (this.resourceLoadFuncs.length != 0) {
|
if (this.resourceLoadFuncs.length != 0) {
|
||||||
if (lock)
|
if (lock)
|
||||||
|
|
@ -1101,8 +1174,10 @@ class MarbleWorld extends Scheduler {
|
||||||
} else {
|
} else {
|
||||||
if (this._resourcesLoaded < _loadingLength)
|
if (this._resourcesLoaded < _loadingLength)
|
||||||
return;
|
return;
|
||||||
if (!_ready)
|
if (!_ready && !postInited) {
|
||||||
|
postInited = true;
|
||||||
postInit();
|
postInit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import hxd.res.Loader;
|
||||||
import src.Resource;
|
import src.Resource;
|
||||||
import src.ResourceLoaderWorker;
|
import src.ResourceLoaderWorker;
|
||||||
import fs.TorqueFileSystem;
|
import fs.TorqueFileSystem;
|
||||||
|
import src.Settings;
|
||||||
|
|
||||||
class ResourceLoader {
|
class ResourceLoader {
|
||||||
#if (hl && !android)
|
#if (hl && !android)
|
||||||
|
|
@ -191,33 +192,36 @@ class ResourceLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
static function preloadShapes(onFinish:Void->Void) {
|
static function preloadShapes(onFinish:Void->Void) {
|
||||||
var toloadfiles = [];
|
var toloadfiles = [
|
||||||
var toloaddirs = [];
|
StringTools.replace(Settings.optionsSettings.marbleModel, "data/", ""),
|
||||||
var filestats = fileSystem.dir("shapes");
|
"shapes/balls/" + Settings.optionsSettings.marbleSkin + ".marble.png"
|
||||||
for (file in filestats) {
|
];
|
||||||
if (file.isDirectory) {
|
// var toloaddirs = [];
|
||||||
toloaddirs.push(file);
|
// var filestats = fileSystem.dir("shapes");
|
||||||
} else {
|
// for (file in filestats) {
|
||||||
toloadfiles.push(file);
|
// if (file.isDirectory) {
|
||||||
}
|
// toloaddirs.push(file);
|
||||||
}
|
// } else {
|
||||||
while (toloaddirs.length > 0) {
|
// toloadfiles.push(file);
|
||||||
var nextdir = toloaddirs.pop();
|
// }
|
||||||
for (file in fileSystem.dir(nextdir.path.substring(2))) {
|
// }
|
||||||
if (file.isDirectory) {
|
// while (toloaddirs.length > 0) {
|
||||||
toloaddirs.push(file);
|
// var nextdir = toloaddirs.pop();
|
||||||
} else {
|
// for (file in fileSystem.dir(nextdir.path.substring(2))) {
|
||||||
toloadfiles.push(file);
|
// if (file.isDirectory) {
|
||||||
}
|
// toloaddirs.push(file);
|
||||||
}
|
// } else {
|
||||||
}
|
// toloadfiles.push(file);
|
||||||
var teleportPad = fileSystem.get("interiors_mbp/teleportpad.dts");
|
// }
|
||||||
var teleportTexture = fileSystem.get("interiors_mbp/repairbay.jpg");
|
// }
|
||||||
toloadfiles.push(teleportPad); // Because its not in the shapes folder like wtf
|
// }
|
||||||
toloadfiles.push(teleportTexture);
|
// var teleportPad = fileSystem.get("interiors_mbp/teleportpad.dts");
|
||||||
|
// var teleportTexture = fileSystem.get("interiors_mbp/repairbay.jpg");
|
||||||
|
// toloadfiles.push(teleportPad); // Because its not in the shapes folder like wtf
|
||||||
|
// toloadfiles.push(teleportTexture);
|
||||||
var worker = new ResourceLoaderWorker(onFinish);
|
var worker = new ResourceLoaderWorker(onFinish);
|
||||||
for (file in toloadfiles) {
|
for (file in toloadfiles) {
|
||||||
worker.addTaskParallel((fwd) -> file.load(fwd));
|
worker.loadFile(file);
|
||||||
}
|
}
|
||||||
worker.run();
|
worker.run();
|
||||||
}
|
}
|
||||||
|
|
@ -244,6 +248,9 @@ class ResourceLoader {
|
||||||
if (!StringTools.startsWith(path, "data/"))
|
if (!StringTools.startsWith(path, "data/"))
|
||||||
path = "data/" + path;
|
path = "data/" + path;
|
||||||
#end
|
#end
|
||||||
|
#if (js || android)
|
||||||
|
path = StringTools.replace(path, "data/", "");
|
||||||
|
#end
|
||||||
return ResourceLoader.loader.load(path);
|
return ResourceLoader.loader.load(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -288,11 +288,13 @@ class Settings {
|
||||||
levelStatistics.set(key, value);
|
levelStatistics.set(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if js
|
||||||
if (optionsSettings.marbleIndex == null) {
|
if (optionsSettings.marbleIndex == null) {
|
||||||
optionsSettings.marbleIndex = 0;
|
optionsSettings.marbleIndex = 0;
|
||||||
optionsSettings.marbleSkin = "base";
|
optionsSettings.marbleSkin = "base";
|
||||||
optionsSettings.marbleModel = "data/shapes/balls/ball-superball.dts";
|
optionsSettings.marbleModel = "data/shapes/balls/ball-superball.dts";
|
||||||
}
|
}
|
||||||
|
#end
|
||||||
highscoreName = json.highscoreName;
|
highscoreName = json.highscoreName;
|
||||||
} else {
|
} else {
|
||||||
save();
|
save();
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import h3d.Vector;
|
||||||
import src.ResourceLoader;
|
import src.ResourceLoader;
|
||||||
import src.DtsObject;
|
import src.DtsObject;
|
||||||
import src.Settings;
|
import src.Settings;
|
||||||
|
import src.ResourceLoaderWorker;
|
||||||
|
|
||||||
class MarbleSelectGui extends GuiImage {
|
class MarbleSelectGui extends GuiImage {
|
||||||
public function new() {
|
public function new() {
|
||||||
|
|
@ -94,7 +95,8 @@ class MarbleSelectGui extends GuiImage {
|
||||||
}
|
}
|
||||||
this.addChild(selectBtn);
|
this.addChild(selectBtn);
|
||||||
|
|
||||||
var marbleShow = buildObjectShow(marbleData[curSelection].dts, new Vector(171, 97), new Vector(150, 150), 2.6, 0);
|
var marbleShow = buildObjectShow(marbleData[curSelection].dts, new Vector(171, 97), new Vector(150, 150), 2.6, 0,
|
||||||
|
["base.marble" => marbleData[curSelection].skin + ".marble"]);
|
||||||
marbleShow.horizSizing = Center;
|
marbleShow.horizSizing = Center;
|
||||||
marbleShow.vertSizing = Bottom;
|
marbleShow.vertSizing = Bottom;
|
||||||
marbleShow.visible = true;
|
marbleShow.visible = true;
|
||||||
|
|
@ -144,14 +146,36 @@ class MarbleSelectGui extends GuiImage {
|
||||||
dtsObj.showSequences = false;
|
dtsObj.showSequences = false;
|
||||||
dtsObj.useInstancing = false;
|
dtsObj.useInstancing = false;
|
||||||
dtsObj.matNameOverride.set("base.marble", marble.skin + ".marble");
|
dtsObj.matNameOverride.set("base.marble", marble.skin + ".marble");
|
||||||
dtsObj.init(null, () -> {}); // The lambda is not gonna run async anyway
|
|
||||||
for (mat in dtsObj.materials) {
|
ResourceLoader.load(dtsObj.dtsPath).entry.load(() -> {
|
||||||
mat.mainPass.enableLights = false;
|
var dtsFile = ResourceLoader.loadDts(dtsObj.dtsPath);
|
||||||
mat.mainPass.culling = None;
|
var directoryPath = haxe.io.Path.directory(dtsObj.dtsPath);
|
||||||
if (mat.blendMode != Alpha && mat.blendMode != Add)
|
var texToLoad = [];
|
||||||
mat.mainPass.addShader(new AlphaChannel());
|
for (i in 0...dtsFile.resource.matNames.length) {
|
||||||
}
|
var matName = dtsObj.matNameOverride.exists(dtsFile.resource.matNames[i]) ? dtsObj.matNameOverride.get(dtsFile.resource.matNames[i]) : dtsFile.resource.matNames[i];
|
||||||
marbleShow.changeObject(dtsObj);
|
var fullNames = ResourceLoader.getFullNamesOf(directoryPath + '/' + matName).filter(x -> haxe.io.Path.extension(x) != "dts");
|
||||||
|
var fullName = fullNames.length > 0 ? fullNames[0] : null;
|
||||||
|
if (fullName != null) {
|
||||||
|
texToLoad.push(fullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var worker = new ResourceLoaderWorker(() -> {
|
||||||
|
dtsObj.init(null, () -> {}); // The lambda is not gonna run async anyway
|
||||||
|
for (mat in dtsObj.materials) {
|
||||||
|
mat.mainPass.enableLights = false;
|
||||||
|
mat.mainPass.culling = None;
|
||||||
|
if (mat.blendMode != Alpha && mat.blendMode != Add)
|
||||||
|
mat.mainPass.addShader(new AlphaChannel());
|
||||||
|
}
|
||||||
|
marbleShow.changeObject(dtsObj);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (texPath in texToLoad) {
|
||||||
|
worker.loadFile(texPath);
|
||||||
|
}
|
||||||
|
worker.run();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var nextBtn = new GuiButton(loadButtonImages("data/ui/marbleSelect/next"));
|
var nextBtn = new GuiButton(loadButtonImages("data/ui/marbleSelect/next"));
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ class PlayGui {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function init(scene2d:h2d.Scene) {
|
public function init(scene2d:h2d.Scene, onFinish:Void->Void) {
|
||||||
this.scene2d = scene2d;
|
this.scene2d = scene2d;
|
||||||
this._init = true;
|
this._init = true;
|
||||||
|
|
||||||
|
|
@ -138,7 +138,9 @@ class PlayGui {
|
||||||
|
|
||||||
powerupBox = new GuiImage(ResourceLoader.getResource('data/ui/game/powerup.png', ResourceLoader.getImage, this.imageResources).toTile());
|
powerupBox = new GuiImage(ResourceLoader.getResource('data/ui/game/powerup.png', ResourceLoader.getImage, this.imageResources).toTile());
|
||||||
initTimer();
|
initTimer();
|
||||||
initGemCounter();
|
initGemCounter(() -> {
|
||||||
|
onFinish();
|
||||||
|
});
|
||||||
initCenterText();
|
initCenterText();
|
||||||
initPowerupBox();
|
initPowerupBox();
|
||||||
initTexts();
|
initTexts();
|
||||||
|
|
@ -254,7 +256,7 @@ class PlayGui {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function initGemCounter() {
|
public function initGemCounter(onFinish:Void->Void) {
|
||||||
gemCountNumbers[0].position = new Vector(30, 0);
|
gemCountNumbers[0].position = new Vector(30, 0);
|
||||||
gemCountNumbers[0].extent = new Vector(43, 55);
|
gemCountNumbers[0].extent = new Vector(43, 55);
|
||||||
|
|
||||||
|
|
@ -301,21 +303,24 @@ class PlayGui {
|
||||||
// gemImageObject.matNameOverride.set("base.gem", "base.gem.");
|
// gemImageObject.matNameOverride.set("base.gem", "base.gem.");
|
||||||
gemImageObject.ambientSpinFactor /= -2;
|
gemImageObject.ambientSpinFactor /= -2;
|
||||||
// ["base.gem"] = color + ".gem";
|
// ["base.gem"] = color + ".gem";
|
||||||
gemImageObject.init(null, () -> {
|
ResourceLoader.load("shapes/items/" + gemColor + ".gem.png").entry.load(() -> {
|
||||||
for (mat in gemImageObject.materials) {
|
gemImageObject.init(null, () -> {
|
||||||
mat.mainPass.enableLights = false;
|
for (mat in gemImageObject.materials) {
|
||||||
|
mat.mainPass.enableLights = false;
|
||||||
|
|
||||||
// Huge hacks
|
// Huge hacks
|
||||||
if (mat.blendMode != Add) {
|
if (mat.blendMode != Add) {
|
||||||
var alphaShader = new h3d.shader.AlphaChannel();
|
var alphaShader = new h3d.shader.AlphaChannel();
|
||||||
mat.mainPass.addShader(alphaShader);
|
mat.mainPass.addShader(alphaShader);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
gemImageScene.addChild(gemImageObject);
|
||||||
gemImageScene.addChild(gemImageObject);
|
var gemImageCenter = gemImageObject.getBounds().getCenter();
|
||||||
var gemImageCenter = gemImageObject.getBounds().getCenter();
|
|
||||||
|
|
||||||
gemImageScene.camera.pos = new Vector(0, 3, gemImageCenter.z);
|
gemImageScene.camera.pos = new Vector(0, 3, gemImageCenter.z);
|
||||||
gemImageScene.camera.target = new Vector(gemImageCenter.x, gemImageCenter.y, gemImageCenter.z);
|
gemImageScene.camera.target = new Vector(gemImageCenter.x, gemImageCenter.y, gemImageCenter.z);
|
||||||
|
onFinish();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ class EndPad extends DtsObject {
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
this.dtsPath = "data/shapes/pads/endarea.dts";
|
this.dtsPath = "data/shapes/pads/endarea.dts";
|
||||||
this.useInstancing = false;
|
|
||||||
this.isCollideable = true;
|
this.isCollideable = true;
|
||||||
this.identifier = "EndPad";
|
this.identifier = "EndPad";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,13 @@ import mis.MissionElement.MissionElementItem;
|
||||||
import src.TimeState;
|
import src.TimeState;
|
||||||
import src.DtsObject;
|
import src.DtsObject;
|
||||||
import src.ResourceLoaderWorker;
|
import src.ResourceLoaderWorker;
|
||||||
|
import src.ResourceLoader;
|
||||||
|
|
||||||
class Gem extends DtsObject {
|
class Gem extends DtsObject {
|
||||||
public var pickedUp:Bool;
|
public var pickedUp:Bool;
|
||||||
|
|
||||||
|
var gemColor:String;
|
||||||
|
|
||||||
public function new(element:MissionElementItem) {
|
public function new(element:MissionElementItem) {
|
||||||
super();
|
super();
|
||||||
dtsPath = "data/shapes/items/gem.dts";
|
dtsPath = "data/shapes/items/gem.dts";
|
||||||
|
|
@ -25,6 +28,7 @@ class Gem extends DtsObject {
|
||||||
color = GEM_COLORS[Math.floor(Math.random() * GEM_COLORS.length)];
|
color = GEM_COLORS[Math.floor(Math.random() * GEM_COLORS.length)];
|
||||||
this.identifier = "Gem" + color;
|
this.identifier = "Gem" + color;
|
||||||
this.matNameOverride.set('base.gem', color + ".gem");
|
this.matNameOverride.set('base.gem', color + ".gem");
|
||||||
|
gemColor = color + ".gem";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override function init(level:MarbleWorld, onFinish:Void->Void) {
|
public override function init(level:MarbleWorld, onFinish:Void->Void) {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ class StartPad extends DtsObject {
|
||||||
public function new() {
|
public function new() {
|
||||||
super();
|
super();
|
||||||
dtsPath = "data/shapes/pads/startarea.dts";
|
dtsPath = "data/shapes/pads/startarea.dts";
|
||||||
useInstancing = false;
|
|
||||||
isCollideable = true;
|
isCollideable = true;
|
||||||
identifier = "StartPad";
|
identifier = "StartPad";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue