Ned's Turkey Farm
A Simple 2.5D Side Scroller
Loading...
Searching...
No Matches
CPlaneObject Class Reference

The plane object. More...

#include <PlaneObject.h>

Inheritance diagram for CPlaneObject:
Collaboration diagram for CPlaneObject:

Public Member Functions

 CPlaneObject ()
 Default constructor.
 
 CPlaneObject (const Vector3 &)
 Constructor.
 
 ~CPlaneObject ()
 Destructor.
 
void Move ()
 Move object.
 
void GetGunMuzzle (Vector3 &, Vector3 &) const
 Get muzzle position and direction.
 
void GunFireFx ()
 Gun fire particle effects.
 
void SetVel (const Vector3 &)
 Set velocity.
 
void SetRoll (float)
 Rotate around Z-axis.
 
- Public Member Functions inherited from CObject
 CObject ()
 Default constructor.
 
 CObject (eSprite, const Vector3 &)
 Constructor.
 
virtual ~CObject ()
 Destructor.
 
void Kill ()
 Kill the object.
 
bool TooOld ()
 Kill me.
 
void GetRenderList (std::vector< Sage::CSpriteDesc3D > &)
 Get render list.
 
const Vector3 & GetPos () const
 Get position.
 
const Vector3 & GetVel () const
 Get velocity.
 
const float GetRoll () const
 Get roll angle.
 
const eSprite GetType () const
 Get sprite type.
 
void SetRotSpeed (float)
 Set roll speed.
 
void SetLifeTime (float)
 Set lifetime.
 
- Public Member Functions inherited from CCommon
float Wrap (float)
 Wrap horizontal distance.
 

Private Member Functions

void EmitSmoke ()
 Emit smoke particle periodically.
 

Private Attributes

float m_fSmokeTimer = 0.0f
 Last time smoke was emitted.
 
float m_fDamage = 0.0f
 Damage taken, between 0.0f and 1.0f.
 
Sage::CSoundDesc m_sSoundDesc
 Engine sound descriptor.
 

Additional Inherited Members

- Protected Attributes inherited from CObject
Sage::CSpriteDesc3D * m_pSpriteDesc = nullptr
 Pointer to sprite descriptor.
 
Vector3 m_vVel = Vector3::Zero
 Velocity.
 
float m_fRollSpeed = 0.0f
 Roll speed in revs per second.
 
float m_fFrameTimer = 0.0f
 Last time the frame was changed.
 
float m_fFrameInterval = 0.1f
 Interval between frames.
 
float m_fBirthTime = 0.0f
 Time of creation.
 
float m_fLifeTime = FLT_MAX
 Time that object lives.
 
Sage::CParticleEngine3D * m_pParticleEngine = nullptr
 Pointer to a particle engine.
 
- Static Protected Attributes inherited from CCommon
static CRendererm_pRenderer = nullptr
 Pointer to the renderer.
 
static CObjectManagerm_pObjectManager = nullptr
 Pointer to the object manager.
 
static CPlaneObjectm_pPlayer = nullptr
 Pointer to player character.
 
static float m_fWorldScale = 2.0f
 World scale.
 
static Vector3 m_vCellSize = Vector3::Zero
 Cell size.
 
static UINT m_nNumCells = 3
 Number of cells.
 
static float m_fWorldWidth = 0.0f
 World width.
 
static eDrawMode m_eDrawMode = eDrawMode::Playing
 Draw mode.
 
static eGameState m_eGameState = eGameState::Loading
 Game state.
 

Detailed Description

The plane object is the player object.

Constructor & Destructor Documentation

◆ CPlaneObject()

CPlaneObject::CPlaneObject ( const Vector3 & p)
Parameters
pInitial position of plane.

Member Function Documentation

◆ EmitSmoke()

void CPlaneObject::EmitSmoke ( )
private

Emit smoke particles proportional to the amount of damage that the plane has taken.

Here is the caller graph for this function:

◆ GetGunMuzzle()

void CPlaneObject::GetGunMuzzle ( Vector3 & pos,
Vector3 & direction ) const

Get muzzle position in local space and its look-at vector. Offsets are hard-coded from the plane sprite.

Parameters
pos[OUT] Gun muzzle position.
direction[OUT] Gun muzzle direction.
Here is the caller graph for this function:

◆ GunFireFx()

void CPlaneObject::GunFireFx ( )

Assumes that m_vMuzzlePos has already been set to the gun muzzle's position.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Move()

void CPlaneObject::Move ( )
virtual

Move the plane, animate its particle engine, enforce upper and lower bounds on the plane's elevation and take damage if it hits the ground. Emit smoke if damaged. Move the audio listener point to the plane's current position.

Reimplemented from CObject.

Here is the call graph for this function:

◆ SetRoll()

void CPlaneObject::SetRoll ( float angle)
virtual

Writer function for the roll angle.

Parameters
angleNew roll angle.

Reimplemented from CObject.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetVel()

void CPlaneObject::SetVel ( const Vector3 & v)
virtual

Writer function for the plane's velocity. Ensure that its x comnponent doesn't get too big or too small, and adjust the engine sound's pitch proportional to speed.

Parameters
vNew velocity.

Reimplemented from CObject.

Here is the call graph for this function:
Here is the caller graph for this function: