define files

beta.r3js.org
polygonboutique 2016-11-23 11:06:08 +01:00
parent 6baed2483f
commit 1387eb262e
5 changed files with 10 additions and 7 deletions

1
defines/editor.js Normal file
View File

@ -0,0 +1 @@
//#define EDITOR__

1
defines/runtime.js Normal file
View File

@ -0,0 +1 @@
//#define RUNTIME__

View File

@ -62,7 +62,7 @@ gulp.task(
gulp.task('compileRuntime', ['build'], gulp.task('compileRuntime', ['build'],
function() { function() {
gulp.src(['./build/defines/runtime.js', './build/game-lib.js']) gulp.src(['./defines/runtime.js', './build/game-lib.js'])
.pipe(concat('game-lib-runtime.js')) .pipe(concat('game-lib-runtime.js'))
.pipe(preprocessor( .pipe(preprocessor(
{ {
@ -101,7 +101,7 @@ gulp.task('compileRuntime', ['build'],
gulp.task('compileEditor', ['build'], gulp.task('compileEditor', ['build'],
function() { function() {
gulp.src(['./build/defines/editor.js', './build/game-lib.js']) gulp.src(['./defines/editor.js', './build/game-lib.js'])
.pipe(concat('game-lib-editor.js')) .pipe(concat('game-lib-editor.js'))
.pipe(preprocessor( .pipe(preprocessor(
{ {

View File

@ -47,12 +47,10 @@ GameLib.D3.ComponentPathControls.prototype.onUpdate = function(
this.pathFollowingComponent.offset.x = 0; this.pathFollowingComponent.offset.x = 0;
this.pathFollowingComponent.offset.y = 0; this.pathFollowingComponent.offset.y = 0;
this.pathFollowingComponent.offset.z = 1; this.pathFollowingComponent.offset.z = 1;
// also: set offset scale
} else if (this.keyRightPressed) { // Right [l] } else if (this.keyRightPressed) { // Right [l]
this.pathFollowingComponent.offset.x = 0; this.pathFollowingComponent.offset.x = 0;
this.pathFollowingComponent.offset.y = 0; this.pathFollowingComponent.offset.y = 0;
this.pathFollowingComponent.offset.z = -1; this.pathFollowingComponent.offset.z = -1;
// also: set offset scale
} }
}; };

View File

@ -6,6 +6,7 @@
* @param accel * @param accel
* @param maxSpeed * @param maxSpeed
* @param baseOffset * @param baseOffset
* @param maxOffset
* @constructor * @constructor
*/ */
GameLib.D3.ComponentPathFollowing = function ComponentPathFollowing( GameLib.D3.ComponentPathFollowing = function ComponentPathFollowing(
@ -14,7 +15,8 @@ GameLib.D3.ComponentPathFollowing = function ComponentPathFollowing(
splineCurve3, splineCurve3,
accel, accel,
maxSpeed, maxSpeed,
baseOffset baseOffset,
maxOffset
) { ) {
this.id = id || GameLib.D3.Tools.RandomId(); this.id = id || GameLib.D3.Tools.RandomId();
@ -28,15 +30,16 @@ GameLib.D3.ComponentPathFollowing = function ComponentPathFollowing(
this.maxSpeed = maxSpeed || 10.0; this.maxSpeed = maxSpeed || 10.0;
this.accel = accel || 2.0; this.accel = accel || 2.0;
this.baseOffset = baseOffset || new GameLib.D3.Vector3(); this.baseOffset = baseOffset || new GameLib.D3.Vector3();
this.maxOffset = maxOffset || new GameLib.D3.Vector3();
// runtime code // runtime code
this.offset = new GameLib.D3.Vector3(); // this one is our destination offset
this.currentPathValue = 0.0; this.currentPathValue = 0.0;
this.offset = new GameLib.D3.Vector3();
this.currentSpeed = 0.0; this.currentSpeed = 0.0;
this.direction = 0; this.direction = 0;
GameLib.D3.Utils.Extend(GameLib.D3.ComponentPathFollowing, GameLib.D3.ComponentInterface); GameLib.D3.Utils.Extend(GameLib.D3.ComponentPathFollowing, GameLib.D3.ComponentInterface);
}; };