aboutsummaryrefslogtreecommitdiffstats
path: root/src/ru/olamedia/olacraft/weapon/BulletScene.java
blob: 1e5ea0516ff7e8fd559d54c23fcd4ef3b6b11dc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package ru.olamedia.olacraft.weapon;

import java.util.ArrayList;
import java.util.List;

import javax.media.opengl.GLAutoDrawable;

public class BulletScene {
	private List<Bullet> bullets = new ArrayList<Bullet>();

	public void add(Bullet b) {
		bullets.add(b);
	}
	
	public int getCount(){
		return bullets.size();
	}

	public void update(float deltas) {
		for (int i = 0; i < bullets.size(); i++) {
			Bullet b = bullets.get(i);
			b.update(deltas);
			if (b.toRemove) {
				bullets.remove(b);
				i--;
			}
		}
	}

	public void render(GLAutoDrawable drawable) {
		for (Bullet b : bullets) {
			b.render(drawable);
		}
	}
}