Started race data storage for replay and ghost features.

This commit is contained in:
Thibaut
2012-10-15 17:51:57 +02:00
parent 657f0354de
commit f2f9d49cac
4 changed files with 19 additions and 1 deletions
+5
View File
@@ -49,6 +49,8 @@ bkcore.hexgl.Gameplay = function(opts)
this.finishTime = null;
this.onFinish = opts.onFinish == undefined ? function(){console.log("FINISH");} : opts.onFinish;
this.raceData = null;
this.modes.timeattack = function()
{
self.hud.updateTime(self.timer.getElapsedTime());
@@ -108,6 +110,8 @@ bkcore.hexgl.Gameplay.prototype.start = function()
this.previousCheckPoint = this.track.checkpoints.start;
this.raceData = new bkcore.hexgl.RaceData(this.track.name, this.mode, this.shipControls);
this.active = true;
this.step = 0;
this.timer.start();
@@ -168,6 +172,7 @@ bkcore.hexgl.Gameplay.prototype.update = function()
else if(this.step == 4)
{
this.modes[this.mode].call(this);
this.raceData.tick(this.timer.time.elapsed);
}
else if(this.step == 100 && this.timer.time.elapsed >= 2000)
{
+11 -1
View File
@@ -532,4 +532,14 @@ bkcore.hexgl.ShipControls.prototype.getShield = function(scale)
this.shield
* (scale == undefined ? 1 : scale)
);
};
};
bkcore.hexgl.ShipControls.prototype.getPosition = function()
{
return this.dummy.position;
}
bkcore.hexgl.ShipControls.prototype.getQuaternion = function()
{
return this.dummy.quaternion;
}
+2
View File
@@ -14,6 +14,8 @@ bkcore.hexgl.tracks.Cityscape = {
lib: null,
materials: {},
name: "Cityscape",
checkpoints: {
list: [0,1,2],
start: 0,
+1
View File
@@ -53,6 +53,7 @@
<script src="bkcore/threejs/Loader.js"></script>
<script src="bkcore/hexgl/HUD.js"></script>
<script src="bkcore/hexgl/RaceData.js"></script>
<script src="bkcore/hexgl/ShipControls.js"></script>
<script src="bkcore/hexgl/ShipEffects.js"></script>
<script src="bkcore/hexgl/CameraChase.js"></script>