Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/world_entity.cc @ 2080

Last change on this file since 2080 was 2077, checked in by patrick, 20 years ago

/orxonox/trunk/src: making doxygen comments in worldentity, player, world; extending API of worldentity; inserting list.h in world - this version does not compile

File size: 4.1 KB
RevLine 
[2036]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
[2043]22#include "vector.h"
23
[2036]24using namespace std;
25
26
[2043]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.
37This is some sort of standard interface to all WorldEntities...
38*/
[2036]39WorldEntity::WorldEntity () 
40{
41  health = 100;
42  speed = 0;
43}
44
45
46WorldEntity::~WorldEntity () {}
47
[2043]48/**
49   \brief sets the position of this entity
50   \param position: Vector, pointing (from 0,0,0) to the new position
51*/
52void WorldEntity::setPosition(Vector* position) {} 
[2036]53
[2043]54/**
55   \brief gets the postion of this entity
56   \return a Vector, pointing (from 0,0,0) to the new position
57*/
58Vector* getPosition() {}
[2036]59
[2043]60/**
61   \brief sets orientation of this entity
62   \param orientation: vector specifying in which direction the entity looks
63*/
64void WorldEntity::setOrientation(Vector* orientation) {}
[2036]65
[2043]66/**
67   \brief gets orientation of this entity
68   \return vector specifying in which direction the entity looks
69*/
70Vector* 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*/
[2036]76void WorldEntity::setSpeed(float speed)
77{
78  this->speed = speed;
79}
80
[2043]81/**
82   \brief gets the speed of the entity, if any
83   \return the speed in points (openGL points) per seconds
84*/
[2036]85float WorldEntity::getSpeed()
86{
87  return speed;
88}
89
[2043]90/**
91   \brief sets the health of the entity
92   \param health: number for the life count, normaly {0..100}
93*/
[2036]94void WorldEntity::setHealth(float health)
95{
96  this->health = health;
97}
98
[2043]99/**
100   \brief gets the health of the entity
101   \return number for the life count, normaly {0..100}
102*/
[2036]103float WorldEntity::getHealth()
104{
105  return health;
106}
107
[2043]108/**
109   \brief this method is called every tick
[2077]110   \param time: the time since the last frame was painted
[2036]111
[2043]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*/
[2077]114void WorldEntity::tick(float dt) 
[2036]115{}
116
[2043]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*/
[2036]122void WorldEntity::paint() 
[2077]123{}
[2036]124
125/* virtual void WorldEntity::actionEvent(Event* event); */
[2043]126/**
127   \brief this function is called, when two entities collide
128   \param we: the world entity, with whom it collides
129   \param loc: place where the collision happens
130*/
131void WorldEntity::collide(WorldEntity* we, Vector loc) {}
[2036]132
[2043]133/**
134   \brief this function is called, when the ship is hit by a waepon
135   \param weapon: the laser/rocket/shoot that hits.
136   \param loc: place where it is hit
[2036]137
[2043]138   calculate the damage depending
139*/
140void WorldEntity::hit(WorldEntity* weapon, Vector loc) {}
141
142/**
143   \brief this function is called, if the entity is to be destroied
144   
145   This can be called, if eg. something realy bad happens :)
146*/
147void WorldEntity::destroy() {}
148
149/**
150   \brief this function is automatically called before the entity enters the world
151*/
152void WorldEntity::entityPreEnter() {}
153
154/**
155   \brief this function is automatically called after the entity enters the world
156
157*/
158void WorldEntity::entityPostEnter() {}
159
160/**
161   \brief this function is automatically called before the entity quits the world
162
163*/
164void WorldEntity::entityPreQuit() {}
165
166/**
167   \brief this function is automatically called after the entity quits the world
168*/
169void WorldEntity::entityPostQuit() {}
Note: See TracBrowser for help on using the repository browser.