this['init'] =
function initTank(align){
Unit.init.call(this, align);
- this.projectile = this.defaultProjectile = Bullet.lookup(this.projectile);
- this.colors = Y.extend({}, this.colors);
this.atkGauge = new CooldownGauge(this.cooldowns.attack, this.width+1,this.height+1);
- this.onBulletDeath = this.onBulletDeath.bind(this);
};
- Lootable.mixInto(Tank);
-
- this['onBulletDeath'] =
- function onBulletDeath(evt){ this.nShots--; };
+ // Lootable.mixInto(Tank);
this['init'] =
function initTower(align){
Unit.init.call(this, align);
- this.projectile = this.defaultProjectile = Bullet.lookup(this.projectile);
- this.colors = Y.extend({}, this.colors);
- this.atkGauge = new CooldownGauge(this.cooldowns.attack, this.width+1,this.height+1);
- this.onBulletDeath = this.onBulletDeath.bind(this);
+ // this.atkGauge = new CooldownGauge(this.cooldowns.attack, this.width+1,this.height+1);
};
- Lootable.mixInto(Tower);
-
- this['onBulletDeath'] =
- function onBulletDeath(evt){ this.nShots--; };
+ // Lootable.mixInto(Tower);
var Y = require('Y').Y
, Vec = require('ezl/math/vec').Vec
-, constants = require('tanks/constants')
-, BoundsType = constants.BoundsType
-, DensityType = constants.DensityType
+, constants = require('tanks/constants')
+, BoundsType = constants.BoundsType
+, DensityType = constants.DensityType
, Thing = require('tanks/thing/thing').Thing
+, Bullet = require('tanks/thing/bullet').Bullet
+, Lootable = require('tanks/mixins/lootable').Lootable
, LinearTrajectory = require('tanks/map/pathing/lineartrajectory').LinearTrajectory
, Traversal = require('tanks/map/pathing/traversal').Traversal
Unit =
exports['Unit'] =
Thing.subclass('Unit', {
+ __mixins__ : [ Lootable ],
+ __bind__ : [ 'onBulletDeath' ],
+
isUnit : true,
isCombatant : true,
hasBarrel : false,
+ projectile : 'bullet',
+ defaultProjectile : null,
+
+ colors : {},
recoil : {
remaining : 0,
speed : 0,
vec : null
},
+
+ align : null,
+ buffs : null,
+
nShots : 0,
init : function initUnit(align){
Thing.init.call(this, align);
this.recoil = Y.extend({}, this.recoil);
+ this.colors = Y.extend({}, this.colors);
+ this.projectile = this.defaultProjectile = Bullet.lookup(this.projectile);
},
+ onBulletDeath : function onBulletDeath(evt){
+ this.nShots = Math.max(0, this.nShots-1);
+ },
/**
* Fires this agent's cannon. If a target location is omitted, the shot