Permalink
Cannot retrieve contributors at this time
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?
TowerDefense/src/MinionFactory.java
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
42 lines (37 sloc)
697 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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++; | |
} | |
} | |
} |