forked from kyleconroy/starfighter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassivemodel.cpp
More file actions
56 lines (48 loc) · 1.2 KB
/
passivemodel.cpp
File metadata and controls
56 lines (48 loc) · 1.2 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "passivemodel.h"
#include "boundingsphere.h"
#include "boundingbox.h"
#include "log.h"
PassiveModel::PassiveModel() : Model() {
damage = 10;
score = 5;
}
PassiveModel::PassiveModel(Eigen::Vector3f pos) : Model(pos) {
damage = 10;
score = 5;
}
void PassiveModel::update() {
}
void PassiveModel::dump() {
if (DEBUG) {
dumpTransM();
}
LOG("\tType:\tPassiveModel",1);
if (mesh == NULL) {
LOG("\tMesh:\tNULL",1);
} else {
LOG("\tMesh:\t" << mesh->name,1);
}
LOG("\t\tPosition:\t" << position.x() << ", " << position.y()<< ", " << position.z() ,1);
LOG("\t\tRotation:\t" << rotate[0] << ", " << rotate[1] << ", " << rotate[2] ,1);
LOG("\t\tScale:\t" << scale[0] << ", " << scale[1] << ", " << scale[2] ,1);
bs->dump();
}
void PassiveModel::addSelf(kdtree *tree) {
calculateTransform();
if(mesh->boundingbox)
bs = new BoundingBox(this);
else
bs = new BoundingSphere(this);
bs->update(mesh);
bs->transform(&transM, scale[0]);
bs->addSelf(tree);
};
void PassiveModel::hit(Model *otherModel) {
// instant kill, no health
if (dead) {
return;
}
if(!indestructable){
die();
}
}