shard entity functionality has been added
This commit is contained in:
@@ -8,6 +8,7 @@ import com.badlogic.gdx.utils.Pool;
|
||||
|
||||
import zero1hd.polyjet.entity.ally.Laser;
|
||||
import zero1hd.polyjet.entity.enemies.Pellet;
|
||||
import zero1hd.polyjet.entity.enemies.Shard;
|
||||
import zero1hd.polyjet.entity.enemies.VoidCircle;
|
||||
|
||||
public class EntityController {
|
||||
@@ -19,6 +20,7 @@ public class EntityController {
|
||||
//Enemy pool declaration;
|
||||
private Pool<VoidCircle> voidCirclePool;
|
||||
private Pool<Pellet> pelletPool;
|
||||
private Pool<Shard> shardPool;
|
||||
|
||||
//Ally pool declaration;
|
||||
private Pool<Laser> laserPool;
|
||||
@@ -43,6 +45,12 @@ public class EntityController {
|
||||
return new Pellet(assets.get("pellet.png", Texture.class));
|
||||
}
|
||||
};
|
||||
shardPool = new Pool<Shard>() {
|
||||
@Override
|
||||
protected Shard newObject() {
|
||||
return new Shard(assets.get("shard.png", Texture.class));
|
||||
}
|
||||
};
|
||||
|
||||
//Ally pool initialization;
|
||||
laserPool = new Pool<Laser>() {
|
||||
@@ -68,6 +76,10 @@ public class EntityController {
|
||||
Pellet pellet = pelletPool.obtain();
|
||||
activeEnemies.add(pellet);
|
||||
return pellet;
|
||||
case SHARD:
|
||||
Shard shard = shardPool.obtain();
|
||||
activeEnemies.add(shard);
|
||||
return shard;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -92,6 +104,13 @@ public class EntityController {
|
||||
pellet.remove();
|
||||
activeEnemies.removeValue(entity, true);
|
||||
pelletPool.free(pellet);
|
||||
break;
|
||||
case SHARD:
|
||||
Shard shard = (Shard) entity;
|
||||
shard.remove();
|
||||
activeEnemies.removeValue(entity, true);
|
||||
shardPool.free(shard);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user