1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
// Description:
// Basic enemy controller. Controls enemy movement along paths.
//
// Copyright (C) 2005 Frank Becker
//
// This program is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
//
#ifndef _BaseEnemy_hpp_
#define _BaseEnemy_hpp_
#include <Point.hpp>
#include <LevelPack.hpp>
#include <ParticleGroup.hpp>
class BaseEnemy: public ParticleType
{
public:
BaseEnemy( LEnemy *le, std::string name);
virtual ~BaseEnemy();
virtual bool update( ParticleInfo *p);
virtual void hit( ParticleInfo *p, int /*damage*/, int /*radIndex*/);
void updateOffset( void);
void sendHome( void);
void getNextPath( void);
protected:
enum MoveState
{
eIdle,
eEntry,
eAttack,
eRetreat,
eTransition,
eLAST
};
//transforms y axis to at vector
void alignWith( Point3D &at);
LEnemy *_lEnemy;
int _energy;
float _levelStartTime;
float _pathStartTime;
bool _enableDraw;
bool _extraUpdateAfterTransport;
Point3D _dir;
Point3D _prevDir;
Point3D _pos;
Point3D _offset;
MoveState _moveState;
MoveState _nextMoveState;
LPath *_activePath;
LPath *_nextPath;
int _activePathIndex;
LPath _transitionPath;
BezierCurve<Point3D> &_transitionBC;
static ParticleGroup *_enemyGroup;
};
#endif
|