1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: Benjamin Grauer |
---|
13 | co-programmer: ... |
---|
14 | */ |
---|
15 | |
---|
16 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON |
---|
17 | |
---|
18 | #include "aiming_system.h" |
---|
19 | |
---|
20 | #include "util/loading/load_param.h" |
---|
21 | |
---|
22 | #include "state.h" |
---|
23 | |
---|
24 | #include <vector> |
---|
25 | |
---|
26 | |
---|
27 | using namespace std; |
---|
28 | |
---|
29 | |
---|
30 | /** |
---|
31 | * standart constructor |
---|
32 | */ |
---|
33 | AimingSystem::AimingSystem (const TiXmlElement* root) |
---|
34 | { |
---|
35 | this->init(); |
---|
36 | |
---|
37 | |
---|
38 | if (root) |
---|
39 | this->loadParams(root); |
---|
40 | } |
---|
41 | |
---|
42 | |
---|
43 | /** |
---|
44 | * destroys a AimingSystem |
---|
45 | */ |
---|
46 | AimingSystem::~AimingSystem () |
---|
47 | {} |
---|
48 | |
---|
49 | |
---|
50 | /** |
---|
51 | * initializes the AimingSystem |
---|
52 | */ |
---|
53 | void AimingSystem::init() |
---|
54 | { |
---|
55 | this->setClassID(CL_CROSSHAIR, "AimingSystem"); |
---|
56 | this->setName("AimingSystem"); |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | void AimingSystem::loadParams(const TiXmlElement* root) |
---|
61 | { |
---|
62 | PNode::loadParams(root); |
---|
63 | |
---|
64 | // LoadParam(root, "texture", this, AimingSystem, setTexture) |
---|
65 | // .describe("the texture-file to load onto the AimingSystem"); |
---|
66 | // |
---|
67 | // LoadParam(root, "size", this, AimingSystem, setSize) |
---|
68 | // .describe("the size of the AimingSystem in Pixels"); |
---|
69 | // |
---|
70 | // LoadParam(root, "rotation-speed", this, AimingSystem, setRotationSpeed) |
---|
71 | // .describe("the Speed with which the AimingSystem should rotate"); |
---|
72 | } |
---|
73 | |
---|
74 | |
---|
75 | |
---|
76 | /** |
---|
77 | * get back the nearest target |
---|
78 | */ |
---|
79 | inline WorldEntity* AimingSystem::getNearestTarget() |
---|
80 | { |
---|
81 | if( this->selectionList.size() == 0) |
---|
82 | return NULL; |
---|
83 | else if( this->selectionList.size() == 1) |
---|
84 | return this->selectionList.back(); |
---|
85 | |
---|
86 | // WorldEntity* nearestEntity = this->; |
---|
87 | |
---|
88 | for( int i = 0; i < this->selectionList.size(); i++) |
---|
89 | { |
---|
90 | |
---|
91 | } |
---|
92 | } |
---|
93 | |
---|
94 | |
---|
95 | /** |
---|
96 | * called when an object is "selected" |
---|
97 | * @param damage damage to be dealt |
---|
98 | * @param killer the entity |
---|
99 | */ |
---|
100 | void AimingSystem::hit(float damage, WorldEntity* killer) |
---|
101 | { |
---|
102 | this->selectionList.push_back(killer); |
---|
103 | } |
---|
104 | |
---|
105 | |
---|
106 | |
---|
107 | /** |
---|
108 | * ticks the AimingSystem |
---|
109 | * @param dt the time to ticks |
---|
110 | */ |
---|
111 | void AimingSystem::tick(float dt) |
---|
112 | { |
---|
113 | } |
---|
114 | |
---|
115 | |
---|
116 | /** |
---|
117 | * draws the crosshair |
---|
118 | */ |
---|
119 | void AimingSystem::draw() const |
---|
120 | { |
---|
121 | } |
---|