Skip to content
Permalink
af42b10cc5
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
42 lines (37 sloc) 697 Bytes
public class MinionFactory {
private int X, Y;
private MapTowerDefense map;
private MinionMock[] minions;
private int Max;
private int id;
public MinionFactory(int x, int y, MapTowerDefense _map) {
X = x;
Y = y;
map = _map;
Max = 100;
id = 0;
minions = new MinionMock[Max];
}
public void createMinion(MinionTypes type) {
MinionMock m = new MinionMock(type, map);
if (id < Max) {
minions[id] = m;
id++;
}
}
public MinionMock[] getMinions() {
return minions;
}
public int getNum() {
return id;
}
public void assignAllDamage() {
int i = 0;
while (i < id) {
if (minions[i].isAlive()) {
minions[i].minionTakeDamage();
}
i++;
}
}
}