-
Notifications
You must be signed in to change notification settings - Fork 0
/
MultiTripleAntenna.cpp
39 lines (31 loc) · 1.28 KB
/
MultiTripleAntenna.cpp
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
36
37
38
39
#include "MultiTripleAntenna.h"
#include "Engine.h"
#include "Environment.h"
#include "Object.h"
#include <cmath>
MultiTripleAntenna::MultiTripleAntenna() : Sensor("SENSOR_MULTI_TRIPLE_ANTENNA") {
}
MultiTripleAntenna::~MultiTripleAntenna() {
}
void MultiTripleAntenna::handleStimulus(Object *object, Environment *environment, double dt) {
nearestObjects = environment->getNearestObjects(object);
}
void MultiTripleAntenna::renderFeedback(Object *object, Environment *environment) {
if (object == environment->getPlayer()) {
Vector2D windowPos = environment->getWindowPos(object->getPosition());
int count = 0;
for (int i = 0; i < nearestObjects.size() && count < 8; i++, count++) {
if (nearestObjects[i]->isVisible()) {
Vector2D objectWindowPos = environment->getWindowPos(nearestObjects[i]->getPosition());
al_draw_line(windowPos.getX(),
windowPos.getY(),
objectWindowPos.getX(),
objectWindowPos.getY(),
al_map_rgb(196, 196, 196), 2.0);
}
}
}
}
Sensor *MultiTripleAntenna::clone() {
return new MultiTripleAntenna();
}