1 package cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric;
2
3 import java.util.UUID;
4 import java.util.concurrent.Future;
5 import java.util.logging.Logger;
6
7 import javax.vecmath.Vector3d;
8
9 import cz.cuni.amis.pogamut.base.agent.module.SensomotoricModule;
10 import cz.cuni.amis.pogamut.base.communication.worldview.object.IWorldObjectEventListener;
11 import cz.cuni.amis.pogamut.base.communication.worldview.object.event.WorldObjectUpdatedEvent;
12 import cz.cuni.amis.pogamut.base3d.worldview.object.Location;
13 import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;
14 import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot;
15 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.AutoTraceRay;
16 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.AutoTraceRayMessage;
17 import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Self;
18
19 public class RaycastingBSP extends SensomotoricModule<UT2004Bot> {
20
21 int counter = 0;
22 private String idSuffix;
23
24 private IWorldObjectEventListener<Self, WorldObjectUpdatedEvent<Self>> selfListener = new IWorldObjectEventListener<Self, WorldObjectUpdatedEvent<Self>>() {
25
26 @Override
27 public void notify(WorldObjectUpdatedEvent<Self> event) {
28 selfUpdate(event.getObject());
29 }
30
31 };
32
33 public RaycastingBSP(UT2004Bot bot) {
34 this(bot, null);
35 }
36
37
38 public RaycastingBSP(UT2004Bot bot, Logger log) {
39 super(bot, log);
40
41 idSuffix = "_" + bot.getName() + UUID.randomUUID().toString();
42
43 bot.getWorldView().addObjectListener(Self.class, WorldObjectUpdatedEvent.class, selfListener);
44 }
45
46
47
48
49
50 public boolean isUsable() {
51 return false;
52 }
53
54
55
56
57
58 public void clear() {
59 }
60
61 public Future<AutoTraceRay> createRay(Vector3d direction, int length, boolean floorCorrection) {
62 String id = counter++ + idSuffix;
63 return createRay(id, direction, length, floorCorrection);
64 }
65
66 public Future<AutoTraceRay> createRay(String id, Vector3d direction, int length, boolean floorCorrection) {
67
68 UnrealId unrealId = UnrealId.get(id);
69 return null;
70 }
71
72 protected void selfUpdate(Self self) {
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90 }
91
92
93 }