This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
updateTargetTrackSlow() { | |
// We always have a deadzone. If we don't, that means we haven't set the target yet so | |
// there's no sense in doing anything in this method yet. | |
if (!this.deadzone) { | |
return; | |
} | |
this._targetPosition.copyFrom(this.target); | |
if (this.target.parent) { | |
this._targetPosition.multiply(this.target.parent.worldTransform.a, this.target.parent.worldTransform.d); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global ig: true */ | |
ig.module( | |
'game.system.eventChain' | |
) | |
.requires( | |
'impact.impact' | |
) | |
.defines(function() { | |
// Defines a function that can fire sequential events. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Defines a function that can fire sequential events. | |
EventChain = function() { | |
// Make sure we get called with new. | |
if (this === window) { | |
return new EventChain(); | |
} | |
var steps = []; | |
// Called every frame. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update.wait = function(secs) { | |
var decrement = secs; | |
steps.push(function() { | |
// Update. | |
if (decrement) { | |
decrement -= ig.system.tick; | |
} | |
// End. | |
if (decrement <= 0) { | |
steps.shift(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update.then = function(doThis) { | |
steps.push(function() { | |
// Update. | |
doThis(); | |
// End. | |
steps.shift(); | |
}); | |
return this; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update.during = function(doThis) { | |
if (!steps) { | |
throw new Error('during only works with previous step!'); | |
} | |
var func = steps[steps.length - 1]; | |
steps[steps.length - 1] = function() { | |
doThis(); | |
func(); | |
}; | |
return this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update.every = function(sec, doThis) { | |
update.during( | |
new EventChain() | |
.wait(sec) | |
.then(doThis) | |
.repeat() | |
); | |
return this; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Returned from this constructor thing. | |
return update; | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update.repeat = function(times) { | |
times = times || Infinity; | |
var originalTimes = times; | |
var stepsCopy; | |
steps.push(function() { | |
times -= 1; | |
if (times > 0) { | |
var args = stepsCopy.slice(0); | |
args.unshift(1, 0); | |
[].splice.apply(steps, args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Shamelessly copied from http://blog.yesmeck.com/archives/make-git-automatically-remove-trailing-whitespace-before-committing/ | |
# | |
# What's distinct about this version, as opposed to several I've seen, | |
# is that it only fixes the whitespace on lines you've actually changed, | |
# so avoids making you the blamee of code you didn't change. | |
# Find files with trailing whitespace | |
for file in `git diff --check --cached | grep '^[^+-]' | grep -o '^.*[0-9]\+:'` ; do | |
file_name=`echo ${file} | grep -o '^[^:]\+'` |