Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/textEngine/src/world_entities/weapon.cc @ 3766

Last change on this file since 3766 was 3681, checked in by bensch, 19 years ago

orxonox/branches/textEngine: merged trunk here.
merged with command:
svn merge ../trunk textEngine -r 3467:HEAD
no conflicts

File size: 4.5 KB
Line 
1
2
3/*
4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   ### File Specific
14   main-programmer: Patrick Boenzli
15   co-programmer:
16*/
17
18
19#include "weapon.h"
20#include "stdincl.h"
21#include "world_entity.h"
22#include "vector.h"
23#include "model.h"
24#include "projectile.h"
25#include "list.h"
26#include "world.h"
27
28using namespace std;
29
30
31/**
32   \brief standard constructor
33
34   creates a new weapon
35*/
36Weapon::Weapon (PNode* parent, Vector* coordinate, Quaternion* direction) 
37  : WorldEntity()
38{
39  parent->addChild(this, PNODE_ROTATE_AND_MOVE);
40  this->setRelCoor(coordinate);
41  this->setRelDir(direction);
42  WorldInterface* wi = WorldInterface::getInstance();
43  this->worldEntities = wi->getEntityList();
44}
45
46
47/**
48   \brief standard deconstructor
49*/
50Weapon::~Weapon () 
51{
52  // model will be deleted from WorldEntity-destructor
53}
54
55
56/**
57    \brief enables the weapon
58
59    a weapon can be enabled/disabled because of various reasons. if a weapon is
60    been enabled, it can interact in a world. elswhere it wont react to any
61    action.
62*/
63void Weapon::enable()
64{
65  this->enabled = true;
66}
67
68
69/**
70    \brief disables the weapon
71
72    a weapon can be enabled/disabled because of various reasons. if a weapon is
73    been enabled, it can interact in a world. elswhere it wont react to any
74    action.
75*/
76void Weapon::disable()
77{
78  this->enabled = false;
79}
80
81
82/**
83    \brief checks if the weapon is enabled
84    \returns true if enabled
85
86    a weapon can be ebabled/disabled because of various reasons. if a weapon is
87    been enabled, it can interact in a world. elswhere it wont react to any
88    action.
89*/
90bool Weapon::isEnabled()
91{
92  return this->enabled;
93}
94
95
96/**
97   \brief sets a new projectile to the weapon
98   \param new projectile for this weapon
99
100   weapon an projectile are independent, so you can combine them as you want
101*/
102void Weapon::setProjectile(Projectile* projectile)
103{
104  this->projectile = projectile;
105}
106
107
108/**
109   \brief sets a new projectile to the weapon
110   \returns the current projectile of this weapon
111
112   weapon an projectile are independent, so you can combine them as you want
113*/
114Projectile* Weapon::getProjectile()
115{
116  return this->projectile;
117}
118
119
120/**
121   \brief this activates the weapon
122
123   This is needed, since there can be more than one weapon on a ship. the
124   activation can be connected with an animation. for example the weapon is
125   been armed out.
126*/
127void Weapon::activate()
128{}
129
130
131/**
132   \brief this deactivates the weapon
133
134   This is needed, since there can be more than one weapon on a ship. the
135   activation can be connected with an animation. for example the weapon is
136   been armed out.
137*/
138void Weapon::deactivate()
139{}
140
141/**
142   \brief asks if the current weapon is active
143   \returns true if it the weapon is active
144*/
145bool Weapon::isActive()
146{}
147
148/**
149   \brief sets a weapon idle time
150   \param idle time in ms
151
152   a weapon idle time is the time spend after a shoot until the weapon can
153   shoot again
154*/
155void Weapon::setWeaponIdleTime(float time)
156{}
157
158/**
159   \brief gets the weapon idle time
160   \returns idle time in ms
161
162   a weapon idle time is the time spend after a shoot until the weapon can
163   shoot again
164*/
165float Weapon::getWeaponIdleTime(void)
166{}
167
168/**
169   \brief checks if the idle time is elapsed
170   \return true if time is elapsed
171
172   a weapon idle time is the time spend after a shoot until the weapon can
173   shoot again
174*/
175bool Weapon::hasWeaponIdleTimeElapsed(void)
176{}
177
178
179/**
180   \brief fires the weapon
181   
182   this is called from the player.cc, when fire-button is been pushed
183*/
184void Weapon::fire()
185{}
186
187
188/**
189   \brief is called, when the weapon gets hit (=collide with something)
190   \param from which entity it is been hit
191   \param where it is been hit
192
193   this may not be used, since it would make the game relay complicated when one
194   can destroy the weapons of enemies or vice versa.
195*/
196void Weapon::hit (WorldEntity* entity, Vector* position) 
197{}
198
199
200/**
201   \brief is called, when the weapon is destroyed
202
203   this is in conjunction with the hit function, so when a weapon is able to get
204   hit, it can also be destoryed.
205*/
206void Weapon::destroy () 
207{}
208
209
210/**
211   \brief tick signal for time dependent/driven stuff
212*/
213void Weapon::tick (float time) 
214{}
215
216
217/**
218   \brief is called, when there is no fire button pressed
219*/
220void Weapon::weaponIdle()
221{}
222
223
224/**
225   \brief this will draw the weapon
226*/
227void Weapon::draw () 
228{}
229
Note: See TracBrowser for help on using the repository browser.