Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3575 was 3575, checked in by patrick, 19 years ago

orxonox/trunk: weapon skeleton extended

File size: 2.8 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 "objModel.h"
24#include "projectile.h"
25
26using namespace std;
27
28
29/**
30   \brief standard constructor
31
32   creates a new weapon
33*/
34Weapon::Weapon () : WorldEntity()
35{
36  this->model = new OBJModel("");
37}
38
39
40/**
41   \brief standard deconstructor
42*/
43Weapon::~Weapon () 
44{
45  delete this->model;
46}
47
48
49/**
50   \brief sets a new projectile to the weapon
51   \param new projectile for this weapon
52
53   weapon an projectile are independent, so you can combine them as you want
54*/
55void Weapon::setProjectile(Projectile* projectile)
56{
57  this->projectile = projectile;
58}
59
60
61/**
62   \brief sets a new projectile to the weapon
63   \returns the current projectile of this weapon
64
65   weapon an projectile are independent, so you can combine them as you want
66*/
67Projectile* Weapon::getProjectile()
68{
69  return this->projectile;
70}
71
72
73/**
74   \brief this activates the weapon
75
76   This is needed, since there can be more than one weapon on a ship. the
77   activation can be connected with an animation. for example the weapon is
78   been armed out.
79*/
80void Weapon::activate()
81{}
82
83
84/**
85   \brief this deactivates the weapon
86
87   This is needed, since there can be more than one weapon on a ship. the
88   activation can be connected with an animation. for example the weapon is
89   been armed out.
90*/
91void Weapon::deactivate()
92{}
93
94/**
95   \brief asks if the current weapon is active
96   \returns true if it the weapon is active
97*/
98bool Weapon::isActive()
99{}
100
101
102
103
104
105/**
106   \brief tick signal for time dependent/driven stuff
107*/
108void Weapon::tick (float time) 
109{}
110
111/**
112   \brief is called, when the weapon gets hit (=collide with something)
113   \param from which entity it is been hit
114   \param where it is been hit
115
116   this may not be used, since it would make the game relay complicated when one
117   can destroy the weapons of enemies or vice versa.
118*/
119void Weapon::hit (WorldEntity* entity, Vector position) 
120{}
121
122/**
123   \brief is called, when the weapon is destroyed
124
125   this is in conjunction with the hit function, so when a weapon is able to get
126   hit, it can also be destoryed.
127*/
128void Weapon::destroy () 
129{}
130
131
132/**
133   \brief this will draw the weapon
134*/
135void Weapon::draw () 
136{
137  glMatrixMode(GL_MODELVIEW);
138  glPushMatrix();
139
140  float matrix[4][4];
141  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
142  this->getAbsDir().matrix (matrix);
143  glMultMatrixf((float*)matrix);
144  this->model->draw();
145
146  glPopMatrix();
147}
148
Note: See TracBrowser for help on using the repository browser.