Wing 323 - Gamepad Version  V1.0
Public Member Functions | Protected Attributes
Enemy Class Reference

An enemy class manages the common properties and methods shared by enemy within the game. More...

Inheritance diagram for Enemy:
Orc

List of all members.

Public Member Functions

int getHealth ()
 Returns the enemy's health.
void changeHealth (int _health)
 Changes the enemy's health (which is constrained to 0 and the enemy's maximum pre-defined health).
virtual void takeHitDamage (string _bodypartHit)
 Take a specific amount of damage dependant on where the enemy is hit.
virtual void wander (string _walkAnim, float _walkAnimSpeed)
 Enables the enemy to wander/walk toward a randomly positioned way point (within a pre-defined distance from the enemy). This causes the illusion that the enemy is wandering when idle (thus recreating more realistic enemy AI behaviour). Note: This method is under development.
virtual IEnumerator spawnWaypoint ()
 Spawns a new waypoint the enemy will wander to. Note: This method is under development.
virtual void goBerserk (float _sprintSpeed, string _sprintAnim, float _sprintAnimSpeed)
 When an enemy goes beserk it will charge the player (sprinting toward them) to inflict damage.
virtual void die (string _deathAnim, float _timeToDestroySelf)
 Enemy dies (usually a death animation followed by sound and then the object destroys itself, freeing up resources/memory in the game)
IEnumerator destroySelfDelay (float _time)
 The self destroy delay time a enemy waits until it destroys itself.
void calcDistFromPlayer ()
 Calculates the distance from the enemy to the player.
virtual void playSoundEffect (AudioClip _soundEffect, bool _isLooping)
 Plays an enemy sound effect (i.e. a roar, death sound etc).
virtual void playSoundEffect (string _animation, AudioClip _soundEffect, bool _isLooping)
 Plays an enemy sound effect in relation to a corresponding animation.

Protected Attributes

int m_health
int m_maxHealth
Vector3 m_nextWaypoint
AudioSource m_currentSoundEffect
AudioClip m_idleSound
AudioClip m_berserkSound
AudioClip m_hitSound
AudioClip m_deathSound
bool m_berserkSoundPlayed
float m_distFromPlayer
float m_firingRange
bool m_isGoingBerserk

Detailed Description

An enemy class manages the common properties and methods shared by enemy within the game.

Author:
Alexander Poolton
Version:
6.0
Date:
1/8/2011

Member Function Documentation

void Enemy::changeHealth ( int  _health) [inline]

Changes the enemy's health (which is constrained to 0 and the enemy's maximum pre-defined health).

Parameters:
[in]_healthThe amount of health to add or subtract.
IEnumerator Enemy::destroySelfDelay ( float  _time) [inline]

The self destroy delay time a enemy waits until it destroys itself.

Parameters:
[in]_timeThe time delay before the enemy destroys itself.
Returns:
yield The amount of time to delay before the enemy destroys itself.
virtual void Enemy::die ( string  _deathAnim,
float  _timeToDestroySelf 
) [inline, virtual]

Enemy dies (usually a death animation followed by sound and then the object destroys itself, freeing up resources/memory in the game)

Parameters:
[in]Theenemy's death animation
[in]Thetime at which the enemy starts the coroutine to destroy itself (after the death animation is played)
int Enemy::getHealth ( ) [inline]

Returns the enemy's health.

Returns:
m_health Returns the enemy's current health.
virtual void Enemy::goBerserk ( float  _sprintSpeed,
string  _sprintAnim,
float  _sprintAnimSpeed 
) [inline, virtual]

When an enemy goes beserk it will charge the player (sprinting toward them) to inflict damage.

Parameters:
[in]_sprintSpeedThe speed the enemy sprints at.
[in]_sprintAnimThe enemy's sprint animation.
[in]_sprintAnimSpeedThe speed the enemy's sprint animation plays at.
virtual void Enemy::playSoundEffect ( AudioClip  _soundEffect,
bool  _isLooping 
) [inline, virtual]

Plays an enemy sound effect (i.e. a roar, death sound etc).

Parameters:
[in]_soundEffectThe audioclip to be played.
[in]_isLoopingIs the audoclip looping or not.
virtual void Enemy::playSoundEffect ( string  _animation,
AudioClip  _soundEffect,
bool  _isLooping 
) [inline, virtual]

Plays an enemy sound effect in relation to a corresponding animation.

Parameters:
[in]_animationThe animation to match the sound effect to.
[in]_soundEffectThe audioclip to be played.
[in]_isLoopingIs the audoclip looping or not.
virtual IEnumerator Enemy::spawnWaypoint ( ) [inline, virtual]

Spawns a new waypoint the enemy will wander to. Note: This method is under development.

Returns:
yield The amount of time to delay before a new waypoint is spawned.
virtual void Enemy::takeHitDamage ( string  _bodypartHit) [inline, virtual]

Take a specific amount of damage dependant on where the enemy is hit.

Parameters:
[in]_bodypartHitThe body part which was hit.
virtual void Enemy::wander ( string  _walkAnim,
float  _walkAnimSpeed 
) [inline, virtual]

Enables the enemy to wander/walk toward a randomly positioned way point (within a pre-defined distance from the enemy). This causes the illusion that the enemy is wandering when idle (thus recreating more realistic enemy AI behaviour). Note: This method is under development.

Parameters:
[in]_walkAnimThe walk animation the enemy uses.
[in]_walkAnimSpeedThe speed of the walk animation.

The documentation for this class was generated from the following file:
 All Classes Functions