Ground support unit implementations
This commit is contained in:
@@ -113,14 +113,14 @@ abstract class BulletComp implements Timedc, Damagec, Hitboxc, Teamc, Posc, Draw
|
||||
Building tile = world.ent(x, y);
|
||||
if(tile == null) return false;
|
||||
|
||||
if(tile.collide(base()) && type.collides(base(), tile) && !tile.dead() && (type.collidesTeam || tile.team() != team())){
|
||||
if(tile.collide(base()) && type.collides(base(), tile) && !tile.dead() && (type.collidesTeam || tile.team != team)){
|
||||
boolean remove = false;
|
||||
|
||||
if(tile.team() != team()){
|
||||
if(tile.team != team){
|
||||
remove = tile.collision(base());
|
||||
}
|
||||
|
||||
if(remove){
|
||||
if(remove || type.collidesTeam){
|
||||
type.hitTile(base(), tile);
|
||||
remove();
|
||||
}
|
||||
|
||||
@@ -93,8 +93,14 @@ abstract class HealthComp implements Entityc{
|
||||
health = Mathf.clamp(health, 0, maxHealth);
|
||||
}
|
||||
|
||||
/** Heals by a flat amount. */
|
||||
void heal(float amount){
|
||||
health += amount;
|
||||
clampHealth();
|
||||
}
|
||||
|
||||
/** Heals by a 0-1 fraction of max health. */
|
||||
void healFract(float amount){
|
||||
heal(amount * maxHealth);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
||||
private UnitType type;
|
||||
boolean spawnedByCore;
|
||||
|
||||
transient float timer1, timer2;
|
||||
|
||||
public void moveAt(Vec2 vector){
|
||||
moveAt(vector, type.accel);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user