![]() |
The Top Down Game Prototype
A Basic Top Down Shooter
|
The guard object. More...
#include <Guard.h>


Public Member Functions | |
| CGuard (const Vector2 &) | |
| Constructor. | |
| ~CGuard () | |
| Destructor. | |
| void | Move () |
| Move. | |
| void | Draw () |
| Draw. | |
Public Member Functions inherited from CArmedObject | |
| CArmedObject (eObject, eSprite, const Vector2 &) | |
| Constructor. | |
| virtual | ~CArmedObject () |
| Destructor. | |
| void | CreateParticle (const Sage::CParticleDesc2D &) |
Public Member Functions inherited from CObject | |
| CObject (eObject, eSprite, const Vector2 &) | |
| Constructor. | |
| virtual | ~CObject () |
| Destructor. | |
| const eObject | GetType () const |
| Get object type. | |
Protected Member Functions | |
| const bool | CloseToPlayer (const float) const |
| Is close to player. | |
| void | CollisionResponse (const Vector2 &, float, CObject *=nullptr) |
| Collision response. | |
| void | ChangeState (eState) |
| Change state. | |
| void | DrawState () |
| Draw state text. | |
| const std::wstring | GetStateString () const |
| Get state text. | |
Protected Member Functions inherited from CArmedObject | |
| const Vector2 | GetViewVector () const |
| Compute view vector. | |
| const Vector2 | GetGunOffset () const |
| Get gun offset. | |
| bool | RotateTowards (const Vector2 &) |
| Swivel towards position. | |
| void | DeathFX () |
| Death special effects. | |
Protected Attributes | |
| eState | m_eState = eState::Alert |
| Guard state. | |
| bool | m_bCCW = true |
| Whether to scan counterclockwise. | |
| Sage::CEventTimer * | m_pWaitEvent = nullptr |
| Wait event. | |
| Sage::CEventTimer * | m_pAlertEvent = nullptr |
| Alert event. | |
| Sage::CEventTimer * | m_pScanningEvent = nullptr |
| Scanning event. | |
| Sage::CEventTimer * | m_pFrameEvent = nullptr |
| Stray event timer. | |
| Sage::CEventTimer * | m_pGunFireEvent = nullptr |
| Gun fire event. | |
Protected Attributes inherited from CArmedObject | |
| UINT | m_nHealth = 1 |
| Current health. | |
| float | m_fRotSpeed = 0 |
| Rotational speed. | |
| Vector2 | m_vCenterOffset |
| Sprite center offset. | |
| Vector2 | m_vGunOffset |
| Sprite gun offset. | |
| Sage::CParticleEngine2D * | m_pLocalParticleEngine = nullptr |
| Pointer to particle engine. | |
Protected Attributes inherited from CObject | |
| eObject | m_eObject = eObject::Unknown |
| Object type. | |
| eSprite | m_eSprite = eSprite::Player |
| Sprite type. | |
| Vector2 | m_vPos |
| Position. | |
| float | m_fRoll = 0 |
| Roll angle. | |
| float | m_fRadius = 0 |
| Bounding circle radius. | |
Private Types | |
| enum class | eState { Alert , Waiting , Scanning , Reloading } |
| State of mind. More... | |
Friends | |
| class | CObjectManager |
| Object manager needs access so it can manage. | |
Additional Inherited Members | |
Static Protected Attributes inherited from CCommon | |
| static Sage::CSpriteRenderer * | m_pRenderer = nullptr |
| Pointer to renderer. | |
| static CObjectManager * | m_pObjectManager = nullptr |
| Pointer to object manager. | |
| static Sage::CParticleEngine2D * | m_pParticleEngine = nullptr |
| Pointer to particle engine. | |
| static CPlayer * | m_pPlayer = nullptr |
| Pointer to player character. | |
| static bool | m_bGodMode = false |
| God mode flag. | |
| static bool | m_bShowState = false |
| Show NPC state flag. | |
| static bool | m_bShowBounds = false |
| Show collision circle flag. | |
The abstract representation of a guard`.
|
strongprivate |
Possible states of mind for a guard.
| CGuard::CGuard | ( | const Vector2 & | p | ) |
Create and initialize a guard object given its position.
| p | Position of guard. |

| CGuard::~CGuard | ( | ) |
The destructor deletes the event timers created by the constructor.
|
protected |
Change state and perform any processing associated with entering the new state. Does nothing if there is no change in state, that is, the new state is the same as the current state.
| newState | The new state. |

|
protected |
Player proximity test.
| d | Required distance to player. |


|
protectedvirtual |
Response to collision. If colliding with a bullet, play a sound, decrement health, and if health is zero then die.
| norm | Collision normal. |
| d | Overlap distance. |
| pObj | Pointer to object being collided with (defaults to nullptr, which means collision with a wall). |
Reimplemented from CObject.

|
virtual |
Draw the current frame of the sprite offset by the center offset value. The current frame will be 0 if not reloading. Change state from Reloading to Waiting once the reloading animation has finished.
Reimplemented from CArmedObject.

|
protected |
Draw the current state as a text string near the guard location on the screen.


|
protected |
Get a string that describes the current state. This will be used to draw the guard's current state on the screen if the player so desires.

|
virtual |
Take action based on state.
Reimplemented from CArmedObject.
