Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/world_entities/world_entity.h @ 5054

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

orxonox/trunk: if a collision occures, the virtual WorldEntity::collidesWith(WorldEntity*, Vector) is called of both objects. the reaction to the collision has to be defined there. default reaction is still output into stdout console. There is now more information

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