evil-inside/src/ei/game/scene/units/APU.java

67 lines
1.4 KiB
Java
Raw Normal View History

2007-04-19 12:38:30 +00:00
package ei.game.scene.units;
import ei.engine.math.Vector2f;
import ei.engine.math.Vector2i;
import ei.engine.scene.Sprite;
import ei.game.player.Player;
import ei.game.scene.SelectBox;
import ei.game.scene.weapons.MachineGun;
import ei.game.scene.weapons.Weapon;
public class APU extends Unit{
private SelectBox selectionBox;
private Sprite sprite;
public APU(Player p) {
this(0, 0, p);
}
public APU(int x, int y, Player p){
super(100, new Vector2i(x,y), p);
this.sprite = new Sprite("Tank", "data/units/apu/apu0000.png");
sprite.setSize(new Vector2f(40,40));
getNode().add(sprite);
selectionBox = new SelectBox(40,40,getMaxLife());
setLife(50);
}
protected SelectBox getSelection() {
return selectionBox;
}
/**
* Returns the weapon connected to this type
* of unit.
*/
public Weapon getWeapon(Vector2f startPos) {
return new MachineGun(startPos);
}
/**
* This unit type is now destroyed.
*/
public void destroyed(){
}
/**
* returns the velocity of the unit type.
* @return
*/
public float getVelocity() {
return 2;
}
/**
* Manages the sprite connected to this unit.
* @param s
*/
public void setSprite(Sprite s) {
this.sprite = s;
}
/**
* returns the sprite connected to this type
* of unit.
* @return
*/
public Sprite getSprite() {
return this.sprite;
}
}