Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/world_entities/weapons/weapon.cc @ 4826

Last change on this file since 4826 was 4826, checked in by bensch, 20 years ago

orxonox/trunk: moved the weaponManager out of Weapon
we have files enough. one more is not too much :)

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