mirror of
https://github.com/jwinterm/SpaceShooter.git
synced 2026-10-17 05:51:30 +02:00
41 lines
844 B
Java
41 lines
844 B
Java
package com.spaceshooter;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.LinkedList;
|
|
import java.util.List;
|
|
import java.util.ListIterator;
|
|
|
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
|
|
|
class PickupManager {
|
|
private List<Pickup> pickupList;
|
|
|
|
public PickupManager() {
|
|
pickupList = new LinkedList<Pickup>();
|
|
}
|
|
public List<Pickup> getList() {
|
|
return pickupList;
|
|
}
|
|
public void draw(SpriteBatch batch) {
|
|
for (Pickup p : pickupList) {
|
|
p.draw(batch);
|
|
}
|
|
}
|
|
public void update() {
|
|
ListIterator<Pickup> pickupIter = pickupList.listIterator();
|
|
while (pickupIter.hasNext()) {
|
|
Pickup p = pickupIter.next();
|
|
p.update();
|
|
|
|
if (p.getY() < SpaceShooter.getBottomBound() - p.getHeight())
|
|
pickupIter.remove();
|
|
|
|
}
|
|
}
|
|
public void clear() {
|
|
pickupList.clear();
|
|
}
|
|
public void dispose() {
|
|
pickupList.clear();
|
|
}
|
|
} |