Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/2d-recalc/src/world_entities/world_entity.h @ 5877

Last change on this file since 5877 was 5356, checked in by bensch, 19 years ago

orxonox/trunk: saver Weapon-Projectile-generation and Stuff

File size: 2.3 KB
Line 
1/*!
2 * @file world_entity.h
3 * Definition of the basic WorldEntity
4*/
5
6#ifndef _WORLD_ENTITY_H
7#define _WORLD_ENTITY_H
8
9#include "p_node.h"
10#include "model.h"
11
12// FORWARD DECLARATION
13class CharacterAttributes;
14class SoundEngine;
15class SoundBuffer;
16class SoundSource;
17class BVTree;
18
19
20//! Basis-class all interactive stuff in the world is derived from
21class WorldEntity : public PNode
22{
23 public:
24  WorldEntity(const TiXmlElement* root = NULL);
25  virtual ~WorldEntity ();
26
27  void loadParams(const TiXmlElement* root);
28
29  /** @see loadModelWithScale(const char*, float) @param fileName the File to load */
30  void loadModel(const char* fileName) { this->loadModelWithScale(fileName, 1.0); };
31  void loadModelWithScale(const char* fileName, float scaling);
32
33  bool buildObbTree(unsigned int depth);
34
35
36  //void addAbility(Ability* ability);
37  //void removeAbility(Ability* ability);
38
39  /** @param visibility if the Entity should be visible (been draw) */
40  void setVisibiliy (bool visibility) { this->bVisible = visibility; };
41  /** @returns true if the entity is visible, false otherwise */
42  bool isVisible() const { return this->bVisible; };
43
44  void setCharacterAttributes(CharacterAttributes* charAttr);
45  CharacterAttributes* getCharacterAttributes();
46
47  /** @returns a reference to the obb tree of this worldentity */
48  BVTree* getOBBTree() { return this->obbTree; };
49
50  virtual void postSpawn ();
51  virtual void leftWorld ();
52
53  virtual void hit (WorldEntity* weapon, Vector* loc);
54  virtual void collidesWith (WorldEntity* entity, const Vector& location);
55
56  /** @returns the Count of Faces on this WorldEntity */
57  virtual unsigned int getFaceCount () const { if (this->model) return this->model->getFaceCount(); else return 0; };
58
59  virtual void tick (float time);
60  virtual void draw ();
61  void drawBVTree(int depth, int drawMode);
62
63 protected:
64  Model*                  model;            //!< The model that should be loaded for this entity.
65  CharacterAttributes*    charAttr;         //!< the character attributes of a world_entity
66  BVTree*                 obbTree;          //!< this is the obb tree reference needed for collision detection
67
68 private:
69  bool                    bCollide;         //!< If it should be considered for the collisiontest.
70  bool                    bVisible;         //!< If it should be visible.
71};
72
73#endif /* _WORLD_ENTITY_H */
Note: See TracBrowser for help on using the repository browser.