1 package nl.tudelft.goal.ut2004.selector;
2
3 import java.util.Collection;
4
5 import cz.cuni.amis.pogamut.base3d.worldview.object.ILocated;
6 import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;
7 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.FlagInfo;
8
9
10
11
12
13
14
15 public class EnemyFlagCarrier extends ContextSelector {
16
17
18
19
20 @Override
21 public String toString() {
22 return "EnemyFlagCarrier";
23 }
24
25 @Override
26 public ILocated select(Collection<? extends ILocated> c) {
27
28 FlagInfo flag = modules.getGame().getCTFFlag(modules.getInfo().getTeam());
29 UnrealId holderId = flag.getHolder();
30 if (holderId == null) {
31 return null;
32 }
33
34 return modules.getPlayers().getPlayer(holderId);
35 }
36
37
38 }