Started race data storage for replay and ghost features.
This commit is contained in:
@@ -49,6 +49,8 @@ bkcore.hexgl.Gameplay = function(opts)
|
|||||||
this.finishTime = null;
|
this.finishTime = null;
|
||||||
this.onFinish = opts.onFinish == undefined ? function(){console.log("FINISH");} : opts.onFinish;
|
this.onFinish = opts.onFinish == undefined ? function(){console.log("FINISH");} : opts.onFinish;
|
||||||
|
|
||||||
|
this.raceData = null;
|
||||||
|
|
||||||
this.modes.timeattack = function()
|
this.modes.timeattack = function()
|
||||||
{
|
{
|
||||||
self.hud.updateTime(self.timer.getElapsedTime());
|
self.hud.updateTime(self.timer.getElapsedTime());
|
||||||
@@ -108,6 +110,8 @@ bkcore.hexgl.Gameplay.prototype.start = function()
|
|||||||
|
|
||||||
this.previousCheckPoint = this.track.checkpoints.start;
|
this.previousCheckPoint = this.track.checkpoints.start;
|
||||||
|
|
||||||
|
this.raceData = new bkcore.hexgl.RaceData(this.track.name, this.mode, this.shipControls);
|
||||||
|
|
||||||
this.active = true;
|
this.active = true;
|
||||||
this.step = 0;
|
this.step = 0;
|
||||||
this.timer.start();
|
this.timer.start();
|
||||||
@@ -168,6 +172,7 @@ bkcore.hexgl.Gameplay.prototype.update = function()
|
|||||||
else if(this.step == 4)
|
else if(this.step == 4)
|
||||||
{
|
{
|
||||||
this.modes[this.mode].call(this);
|
this.modes[this.mode].call(this);
|
||||||
|
this.raceData.tick(this.timer.time.elapsed);
|
||||||
}
|
}
|
||||||
else if(this.step == 100 && this.timer.time.elapsed >= 2000)
|
else if(this.step == 100 && this.timer.time.elapsed >= 2000)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -532,4 +532,14 @@ bkcore.hexgl.ShipControls.prototype.getShield = function(scale)
|
|||||||
this.shield
|
this.shield
|
||||||
* (scale == undefined ? 1 : scale)
|
* (scale == undefined ? 1 : scale)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bkcore.hexgl.ShipControls.prototype.getPosition = function()
|
||||||
|
{
|
||||||
|
return this.dummy.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
bkcore.hexgl.ShipControls.prototype.getQuaternion = function()
|
||||||
|
{
|
||||||
|
return this.dummy.quaternion;
|
||||||
|
}
|
||||||
@@ -14,6 +14,8 @@ bkcore.hexgl.tracks.Cityscape = {
|
|||||||
lib: null,
|
lib: null,
|
||||||
materials: {},
|
materials: {},
|
||||||
|
|
||||||
|
name: "Cityscape",
|
||||||
|
|
||||||
checkpoints: {
|
checkpoints: {
|
||||||
list: [0,1,2],
|
list: [0,1,2],
|
||||||
start: 0,
|
start: 0,
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
<script src="bkcore/threejs/Loader.js"></script>
|
<script src="bkcore/threejs/Loader.js"></script>
|
||||||
|
|
||||||
<script src="bkcore/hexgl/HUD.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/ShipControls.js"></script>
|
||||||
<script src="bkcore/hexgl/ShipEffects.js"></script>
|
<script src="bkcore/hexgl/ShipEffects.js"></script>
|
||||||
<script src="bkcore/hexgl/CameraChase.js"></script>
|
<script src="bkcore/hexgl/CameraChase.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user