flimEngine
Enemy Class Reference

#include <Enemy.h>

Inheritance diagram for Enemy:
Inheritance graph
Collaboration diagram for Enemy:
Collaboration graph

Public Member Functions

void SetMap (Minimap *map)
 
 Enemy (Tank *p)
 
 Enemy (const Enemy &)
 
virtual ~Enemy ()
 
const Enemyoperator= (const Enemy &)
 
void Initialize (float x, float y, float z)
 
void Initialize (float x, float y, float z, Tank *p)
 
virtual errcode Update () override
 Called every frame. More...
 
virtual errcode Draw () override
 Draw callback to override. More...
 
virtual errcode Collision (Tank *)
 
Fired FiredBy ()
 
virtual errcode Collision (Bullet *)
 
errcode SceneEntry () override
 Scene entry callback. More...
 
errcode SceneExit () override
 Scene exit callback. More...
 
- Public Member Functions inherited from GameObject
 GameObject ()
 
virtual ~GameObject ()
 
GameObjectoperator= (const GameObject &)=default
 
 GameObject (const GameObject &)=default
 
errcode SubmitEntry ()
 Submit entry to the scene. More...
 
errcode SubmitExit ()
 Submit exit to the scene. More...
 
- Public Member Functions inherited from Updatable
 Updatable ()
 
virtual ~Updatable ()
 
 Updatable (const Updatable &)=delete
 
const Updatableoperator= (const Updatable &)=delete
 
errcode SubmitUpdateRegistration ()
 Submit update registration. More...
 
errcode SubmitUpdateDeregistration ()
 Submit update deregistration. More...
 
- Public Member Functions inherited from Drawable
 Drawable ()
 
virtual ~Drawable ()
 
 Drawable (const Drawable &)=delete
 
const Drawableoperator= (const Drawable &)=delete
 
virtual errcode Draw2D ()
 
errcode SubmitDrawRegistration ()
 Submit draw registration. More...
 
errcode SubmitDrawDeregistration ()
 Submit draw deregistration. More...
 
std::list< Drawable * >::iterator GetDeletionIterator ()
 
errcode SetDeletionIterator (std::list< Drawable *>::iterator in)
 
- Public Member Functions inherited from Inputable
 Inputable ()
 
virtual ~Inputable ()
 
 Inputable (const Inputable &)=delete
 
const Inputableoperator= (const Inputable &)=delete
 
virtual errcode KeyPressed (AZUL_KEY key)
 Key pressed callback. More...
 
virtual errcode KeyReleased (AZUL_KEY key)
 Key released. More...
 
errcode SubmitInputRegistration (AZUL_KEY key, input_type type)
 Submit input registration. More...
 
errcode SubmitInputDeregistration (AZUL_KEY key, input_type type)
 Submit input deregistration. More...
 
std::list< Inputable * >::iterator GetDeletionIterator ()
 
errcode SetDeletionIterator (std::list< Inputable *>::iterator in)
 
- Public Member Functions inherited from Alarmable
 Alarmable ()
 
Alarmableoperator= (const Alarmable &)
 
virtual ~Alarmable ()
 
 Alarmable (const Alarmable &)
 
errcode SubmitAlarmDeregistration (AlarmableManager::ALARM_ID id)
 Submit alarm deregistration. More...
 
errcode SubmitAlarmRegistration (float t, AlarmableManager::ALARM_ID id)
 Submit alarm registration. More...
 
float TimeLeft (AlarmableManager::ALARM_ID id)
 Time left on one of the alarms. More...
 
errcode ChangeTime (float t, AlarmableManager::ALARM_ID id)
 Change time. More...
 
errcode AddTime (float t, AlarmableManager::ALARM_ID id)
 Adds a time to 'id'. More...
 
errcode SubtractTime (float t, AlarmableManager::ALARM_ID id)
 Subtract time. More...
 
bool IsRegistered (AlarmableManager::ALARM_ID id)
 Query if 'id' is registered. More...
 
errcode SetDeletionIter (int alarmNumber, std::multimap< float, AlarmableManager::AlarmEvent >::const_iterator iter)
 
std::multimap< float, AlarmableManager::AlarmEvent >::const_iterator GetDeletionIter (int alarmNumber)
 
errcode SetRegistrationState (int alarmNumber, RegistrationState state)
 
- Public Member Functions inherited from Collidable
 Collidable ()
 
virtual ~Collidable ()
 
 Collidable (const Collidable &)=delete
 
const Collidableoperator= (const Collidable &)=delete
 
virtual errcode Collision (Collidable *)
 Collision callback. More...
 
virtual errcode CollisionEnter (Collidable *)
 Collision enter. More...
 
virtual errcode CollisionExit ()
 Collision exit. More...
 
virtual errcode CollisionTerrain (const CollisionVolumeAABB &)
 Collision terrain. More...
 
template<typename C >
errcode SubmitCollisionRegistration (C *c)
 Submit collision registration of your type. More...
 
template<typename C >
errcode SubmitCollisionDeregistration (C *c)
 Submit collision deregistration for your type. More...
 
const CollisionVolumeGetCollisionVolume () const
 
errcode SetColliderModel (Model *mod, VolumeType vol)
 Sets collider model. More...
 
errcode UpdateCollisionData (Matrix &mat)
 Updates the collision data described by matrix. More...
 
std::list< Collidable * >::iterator GetDeletionIter ()
 
errcode SetDeletionIter (std::list< Collidable *>::iterator in)
 
bool getColliding () const
 
void setColliding (bool coll)
 
const CollisionVolumeBSpheregetBSphere () const
 

Private Member Functions

void Alarm0 () override
 Alarm 0 callback. More...
 
void Alarm1 () override
 Alarm 1 callback. More...
 
void Alarm2 () override
 Alarm 2 callback. More...
 

Private Attributes

GraphicsObject_TextureLight * pGObj_SpaceEnemyLight
 
GraphicsObject_TextureLight * turretGObj
 
flimSoundengineSnd
 
flimSoundbulletSnd
 
Matrix ShipScale
 
Vect ShipPos
 
Vect prevPos
 
Matrix ShipRot
 
Vect turretPos
 
ENEMYROT curRot
 
ENEMYMOVE curMove
 
Vect originalPos
 
float ShipTransSpeed
 
const float maxMoveSpeed = 1.2f
 
const float acceleration = 1.5f
 
const float deceleration = 1.5f
 
const float ShipRotAng = .05f
 
float TotalTime
 
float FrameTime
 
Fired firedBy = Fired::ByEnemy
 
Tankplayer
 
Minimapminimap
 
const float fireDistance = 10000.0f
 

Additional Inherited Members

- Public Attributes inherited from Updatable
std::list< Updatable * >::iterator deleteIter
 

Constructor & Destructor Documentation

◆ Enemy() [1/2]

Enemy::Enemy ( Tank p)

◆ Enemy() [2/2]

Enemy::Enemy ( const Enemy )
inline

◆ ~Enemy()

Enemy::~Enemy ( )
virtual

Member Function Documentation

◆ Alarm0()

void Enemy::Alarm0 ( )
overrideprivatevirtual

Alarm 0 callback.

Author
Jack Campbell
Date
3/5/2017
Callback for alarms
{
DebugMsg::out("\n\nFIRST FRIGATE ALARMED\n\n");
}
{
DebugMsg::out("\n\nSECOND FRIGATE ALARMED\n\n");
}
{
DebugMsg::out("\n\nTHIRD FRIGATE ALARMED\n\n\n");
}

Reimplemented from Alarmable.

◆ Alarm1()

void Enemy::Alarm1 ( )
overrideprivatevirtual

Alarm 1 callback.

Author
Jack Campbell
Date
3/5/2017
see alarm0

Reimplemented from Alarmable.

◆ Alarm2()

void Enemy::Alarm2 ( )
overrideprivatevirtual

Alarm 2 callback.

Author
Jack Campbell
Date
3/5/2017
see alarm0

Reimplemented from Alarmable.

◆ Collision() [1/2]

errcode Enemy::Collision ( Tank other)
virtual

◆ Collision() [2/2]

errcode Enemy::Collision ( Bullet other)
virtual

◆ Draw()

errcode Enemy::Draw ( )
overridevirtual

Draw callback to override.

Author
Jack Campbell
Date
3/5/2017
This will be called once a frame and should only contain code related to rendering.
{
// Place rendering code here.
// Render ship's graphics object to the current main camera via the Scene
pGObj_SpaceFrigateLight->Render(&SceneManager::GetCurrentScene().GetCamera()->MainCamera());
}
Returns
An errcode.

Reimplemented from Drawable.

◆ FiredBy()

Fired Enemy::FiredBy ( )
inline

◆ Initialize() [1/2]

void Enemy::Initialize ( float  x,
float  y,
float  z 
)

◆ Initialize() [2/2]

void Enemy::Initialize ( float  x,
float  y,
float  z,
Tank p 
)

◆ operator=()

const Enemy& Enemy::operator= ( const Enemy )
inline

◆ SceneEntry()

errcode Enemy::SceneEntry ( )
overridevirtual

Scene entry callback.

Author
Jack Campbell
Date
3/5/2017
This callback fires when a GameObject becomes active.
{
// Registration
// Setting graphics member variables
Matrix world;
ShipPos.set(0, 20, 0);
world = Matrix(TRANS, ShipPos);
pGObj_SpaceFrigateLight->SetWorld(world);
}
Returns
An errcode.

Reimplemented from GameObject.

◆ SceneExit()

errcode Enemy::SceneExit ( )
overridevirtual

Scene exit callback.

Author
Jack Campbell
Date
3/5/2017
This callback is called when a GameObject is deactivated.
Returns
An errcode.

Reimplemented from GameObject.

◆ SetMap()

void Enemy::SetMap ( Minimap map)

◆ Update()

errcode Enemy::Update ( )
overridevirtual

Called every frame.

Author
Jack Campbell
Date
3/5/2017
Update is called once a frame on objects that have been registered to update.
{
// Place frame related content here. This code moves the ship's graphics object.
// Ship translation movement (not using time-based values for simplicity)
if (Keyboard::GetKeyState(AZUL_KEY::KEY_W))
{
ShipPos += Vect(0, 0, 1) * ShipRot * ShipTransSpeed;
}
else if (Keyboard::GetKeyState(AZUL_KEY::KEY_S))
{
ShipPos += Vect(0, 0, 1) * ShipRot * -ShipTransSpeed;
}
// Spaceship adjust matrix
Matrix world = ShipScale * ShipRot * Matrix(TRANS, ShipPos);
pGObj_SpaceFrigateLight->SetWorld(world);
}
Returns
An errcode.

Reimplemented from Updatable.

Member Data Documentation

◆ acceleration

const float Enemy::acceleration = 1.5f
private

◆ bulletSnd

flimSound* Enemy::bulletSnd
private

◆ curMove

ENEMYMOVE Enemy::curMove
private

◆ curRot

ENEMYROT Enemy::curRot
private

◆ deceleration

const float Enemy::deceleration = 1.5f
private

◆ engineSnd

flimSound* Enemy::engineSnd
private

◆ firedBy

Fired Enemy::firedBy = Fired::ByEnemy
private

◆ fireDistance

const float Enemy::fireDistance = 10000.0f
private

◆ FrameTime

float Enemy::FrameTime
private

◆ maxMoveSpeed

const float Enemy::maxMoveSpeed = 1.2f
private

◆ minimap

Minimap* Enemy::minimap
private

◆ originalPos

Vect Enemy::originalPos
private

◆ pGObj_SpaceEnemyLight

GraphicsObject_TextureLight* Enemy::pGObj_SpaceEnemyLight
private

◆ player

Tank* Enemy::player
private

◆ prevPos

Vect Enemy::prevPos
private

◆ ShipPos

Vect Enemy::ShipPos
private

◆ ShipRot

Matrix Enemy::ShipRot
private

◆ ShipRotAng

const float Enemy::ShipRotAng = .05f
private

◆ ShipScale

Matrix Enemy::ShipScale
private

◆ ShipTransSpeed

float Enemy::ShipTransSpeed
private

◆ TotalTime

float Enemy::TotalTime
private

◆ turretGObj

GraphicsObject_TextureLight* Enemy::turretGObj
private

◆ turretPos

Vect Enemy::turretPos
private

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