Enemy Class Reference

#include <Enemy.h>

Inheritance diagram for Enemy:
IShootable

List of all members.

Public Member Functions

 Enemy (Game *game, Physics *physics, H3DRes font, H3DNode parent, const int id)
 ~Enemy ()
void hit ()
void update (H3DNode cam, Player *player, const float timeStep)
bool reset (const bool doRebirth)
void setPosition (const Vec3 &newPosition)
Vec3 getPosition () const
btRigidBody * getBody () const
H3DNode getModel () const
bool hasJumped () const

Detailed Description

This class provides an graphics implementation of an enemy which is also subject to the physics world. That is, he collides with other bodies (like the world that he stands on) or the player etc.

An instance of Enemy directs to the player's position automatically, so he can damage him (not finished yet) An enemy has a certain "level". The higher the level the better the health and shooting capabilities.

If an Enemy has died he may be "reborn" which means his position is reset and he levels up.

Definition at line 27 of file Enemy.h.


Constructor & Destructor Documentation

Enemy::Enemy ( Game game,
Physics physics,
H3DRes  font,
H3DNode  parent,
const int  id 
)
Enemy::~Enemy (  ) 

Definition at line 83 of file Enemy.cpp.


Member Function Documentation

btRigidBody * Enemy::getBody (  )  const

returns the phyiscs body. this is usually needed for testing purposes

Returns:
the bullet rigid body

Definition at line 407 of file Enemy.cpp.

H3DNode Enemy::getModel (  )  const

returns the graphics node

Returns:
the the graphics node

Definition at line 415 of file Enemy.cpp.

Vec3 Enemy::getPosition (  )  const

returns the current position of this enemy in world space

Returns:
the XYZ coordinates for the current position

Definition at line 259 of file Enemy.cpp.

bool Enemy::hasJumped (  )  const

returns the graphics node

Returns:
the the graphics node

Definition at line 423 of file Enemy.cpp.

void Enemy::hit (  )  [virtual]

call this method to damage this IShootable. Hitting an instance would render in a decreasing health until death ocurrs.

Implements IShootable.

Definition at line 265 of file Enemy.cpp.

bool Enemy::reset ( const bool  doRebirth  ) 

this method is called when an enemy has died and may be recycled as new enemy

Returns:
true if this body is reborn; otherwise true so this Enemy can be deleted

Definition at line 275 of file Enemy.cpp.

void Enemy::setPosition ( const Vec3 newPosition  ) 

sets the new enemy position in world space

Parameters:
newPosition the new position in every direction

Definition at line 248 of file Enemy.cpp.

void Enemy::update ( H3DNode  cam,
Player player,
const float  timeStep 
)

updates the enemy's physics and graphics state

Parameters:
cam the player's view camera
physics provides collision information for walking etc
player provides access to the position to the player. furthermore he provides a damage method if the enemy shoots the player
timeStep this amount of time in seconds is about to be rendered

Definition at line 95 of file Enemy.cpp.


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2