24 lines
No EOL
701 B
JavaScript
24 lines
No EOL
701 B
JavaScript
(function() {
|
|
var ALIEN_CHANNEL_BASE = "AlienChannel";
|
|
|
|
var FoodWeapon = function(){
|
|
|
|
};
|
|
|
|
FoodWeapon.prototype = {
|
|
preload: function(entityID){
|
|
Messages.subscribe(ALIEN_CHANNEL_BASE);
|
|
},
|
|
unload: function(){
|
|
Messages.unsubscribe(ALIEN_CHANNEL_BASE);
|
|
},
|
|
collisionWithEntity: function(idA, idB, event) {
|
|
var name = Entities.getEntityProperties(idB, 'name').name;
|
|
if (name.indexOf("Alien") !== -1) {
|
|
Messages.sendMessage(ALIEN_CHANNEL_BASE, JSON.stringify({type: "HitAlienWithFood", alienID: idB}));
|
|
}
|
|
}
|
|
|
|
}
|
|
return new FoodWeapon();
|
|
}) |