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 | #include <iostream> |
---|
19 | |
---|
20 | #include "world_entity.h" |
---|
21 | |
---|
22 | #include "vector.h" |
---|
23 | |
---|
24 | using namespace std; |
---|
25 | |
---|
26 | |
---|
27 | /** |
---|
28 | \brief |
---|
29 | \param v: |
---|
30 | \return |
---|
31 | */ |
---|
32 | |
---|
33 | /** |
---|
34 | \brief Constructor |
---|
35 | |
---|
36 | This Constructor initializises the all WorldEntities. Everything, that is a part of the game-world is a child of WorldEntity. This class implements empty functions for all sort of operation a WorldEntity has to or can implement. |
---|
37 | This is some sort of standard interface to all WorldEntities... |
---|
38 | */ |
---|
39 | WorldEntity::WorldEntity () |
---|
40 | { |
---|
41 | health = 100; |
---|
42 | speed = 0; |
---|
43 | } |
---|
44 | |
---|
45 | |
---|
46 | WorldEntity::~WorldEntity () {} |
---|
47 | |
---|
48 | /** |
---|
49 | \brief sets the position of this entity |
---|
50 | \param position: Vector, pointing (from 0,0,0) to the new position |
---|
51 | */ |
---|
52 | void WorldEntity::setPosition(Vector* position) {} |
---|
53 | |
---|
54 | /** |
---|
55 | \brief gets the postion of this entity |
---|
56 | \return a Vector, pointing (from 0,0,0) to the new position |
---|
57 | */ |
---|
58 | Vector* getPosition() {} |
---|
59 | |
---|
60 | /** |
---|
61 | \brief sets orientation of this entity |
---|
62 | \param orientation: vector specifying in which direction the entity looks |
---|
63 | */ |
---|
64 | void WorldEntity::setOrientation(Vector* orientation) {} |
---|
65 | |
---|
66 | /** |
---|
67 | \brief gets orientation of this entity |
---|
68 | \return vector specifying in which direction the entity looks |
---|
69 | */ |
---|
70 | Vector* WorldEntity::getOrientation() {} |
---|
71 | |
---|
72 | /** |
---|
73 | \brief sets the speed of the entity, if any |
---|
74 | \param speed: the speed in points (openGL points) per seconds |
---|
75 | */ |
---|
76 | void WorldEntity::setSpeed(float speed) |
---|
77 | { |
---|
78 | this->speed = speed; |
---|
79 | } |
---|
80 | |
---|
81 | /** |
---|
82 | \brief gets the speed of the entity, if any |
---|
83 | \return the speed in points (openGL points) per seconds |
---|
84 | */ |
---|
85 | float WorldEntity::getSpeed() |
---|
86 | { |
---|
87 | return speed; |
---|
88 | } |
---|
89 | |
---|
90 | /** |
---|
91 | \brief sets the health of the entity |
---|
92 | \param health: number for the life count, normaly {0..100} |
---|
93 | */ |
---|
94 | void WorldEntity::setHealth(float health) |
---|
95 | { |
---|
96 | this->health = health; |
---|
97 | } |
---|
98 | |
---|
99 | /** |
---|
100 | \brief gets the health of the entity |
---|
101 | \return number for the life count, normaly {0..100} |
---|
102 | */ |
---|
103 | float WorldEntity::getHealth() |
---|
104 | { |
---|
105 | return health; |
---|
106 | } |
---|
107 | |
---|
108 | /** |
---|
109 | \brief this method is called every tick |
---|
110 | \param time: the time since start of the world |
---|
111 | |
---|
112 | This function is called before every repaint of the world, to update every time dependent variable of the entity. If the entity moves, it has to calculate the new position every tick here in this function. Do not use this for animations. |
---|
113 | */ |
---|
114 | void WorldEntity::tick(float time) |
---|
115 | {} |
---|
116 | |
---|
117 | /** |
---|
118 | \brief the entity is painted to the screen with this function |
---|
119 | |
---|
120 | This is a central function of an entity: call it to let the entity painted to the screen. Just override this function with whatever you want to be drawn. |
---|
121 | */ |
---|
122 | void WorldEntity::paint() |
---|
123 | { |
---|
124 | cout << "WorldEntity::paint()" << endl; |
---|
125 | } |
---|
126 | |
---|
127 | /* virtual void WorldEntity::actionEvent(Event* event); */ |
---|
128 | /** |
---|
129 | \brief this function is called, when two entities collide |
---|
130 | \param we: the world entity, with whom it collides |
---|
131 | \param loc: place where the collision happens |
---|
132 | */ |
---|
133 | void WorldEntity::collide(WorldEntity* we, Vector loc) {} |
---|
134 | |
---|
135 | /** |
---|
136 | \brief this function is called, when the ship is hit by a waepon |
---|
137 | \param weapon: the laser/rocket/shoot that hits. |
---|
138 | \param loc: place where it is hit |
---|
139 | |
---|
140 | calculate the damage depending |
---|
141 | */ |
---|
142 | void WorldEntity::hit(WorldEntity* weapon, Vector loc) {} |
---|
143 | |
---|
144 | /** |
---|
145 | \brief this function is called, if the entity is to be destroied |
---|
146 | |
---|
147 | This can be called, if eg. something realy bad happens :) |
---|
148 | */ |
---|
149 | void WorldEntity::destroy() {} |
---|
150 | |
---|
151 | /** |
---|
152 | \brief this function is automatically called before the entity enters the world |
---|
153 | */ |
---|
154 | void WorldEntity::entityPreEnter() {} |
---|
155 | |
---|
156 | /** |
---|
157 | \brief this function is automatically called after the entity enters the world |
---|
158 | |
---|
159 | */ |
---|
160 | void WorldEntity::entityPostEnter() {} |
---|
161 | |
---|
162 | /** |
---|
163 | \brief this function is automatically called before the entity quits the world |
---|
164 | |
---|
165 | */ |
---|
166 | void WorldEntity::entityPreQuit() {} |
---|
167 | |
---|
168 | /** |
---|
169 | \brief this function is automatically called after the entity quits the world |
---|
170 | */ |
---|
171 | void WorldEntity::entityPostQuit() {} |
---|