Wing 323 - Gamepad Version  V1.0
Public Member Functions
Player Class Reference

Manages the player throughout the game. The player has a level of health, takes damage (and will die if that health reaches 0). The player can identify objects, pick them up, use them and add them to their inventory (if they are inventory items). A player can also hold and move objects within the game. More...

List of all members.

Public Member Functions

void Start ()
 Initialises the players attributes.
void Update ()
 The update loop for the player. Within this loop a ray is cast which is used to identify and pickup items (and pickups, i.e. ammo, health, batteries). The use action is also used to open doors. The lift action can be used to lift objects, within the game.
void pickupItem (string _itemName, GameObject _item)
 Pick up an item (the item must be of type inventory item)
void dropItem (string _itemName)
 Drops the item, and removes the item from the player's inventory Note: This method is incomplete.
void takeDamage (string _bodypartHit)
 The player receives damage when being shot, or receiving a meele attack (which is the default case within this switch statement). The body part being hit will alter the amount of damage the player receives. Random ranges of damage are used for each body part, to ensure the damge is not extremely uniform (making it seem a bit more realistic).
void OnControllerColliderHit (ControllerColliderHit _hit)
 Invoked if the player (it's collision capsule component) is hit with a meele attack hit (i.e. at close range, and is not shot).
IEnumerator meeleHitDelay (int _timeDelay)
 The delay (or rate) at which between receiving melee damage (i.e. receive damge every x number of seconds). This is used to ensure the amount of damage received isn't exceptionally fast.
void die ()
 The player is reset and positioned back at their last checkpoint (the last room completed)
void displayDeathScreen ()
 The screen displayed when a player dies.
IEnumerator deathScreenDelay (float _timeDelay)
 The amount of time the death screen is displayed for.
void resetPlayer ()
 Resets the play after dying. The player's health and ammo are reset.
void displayObjectID (RaycastHit _objectHit)
 Display the identify (name) of an object upon a the player's ray (the ray being cast by the player) hitting it.
int getHealth ()
 Gets the player's current health.
void changeHealth (int _health)
 Changes the player's health.
Vector3 getLeftHandPos ()
 Get the position of the player's left hand.
Vector3 getRightHandPos ()
 Get the position of the player's right hand.
bool getIsObjectInLeftHand ()
 Get if their is an object in the left hand or not.
bool getIsObjectInRightHand ()
 Get if their is an object in the right hand or not.
int getNumberOfDeaths ()
 Get the number of times the player has died.
void setIsObjectInLeftHand (bool _isInHand)
 Set if there is an object in the left hand or not.
void setIsObjectInRightHand (bool _isInHand)
 Set if there is an object in the right hand or not.
void setLastCheckpoint (Vector3 _checkpoint)
 Sets the players last checkpoint.

Detailed Description

Manages the player throughout the game. The player has a level of health, takes damage (and will die if that health reaches 0). The player can identify objects, pick them up, use them and add them to their inventory (if they are inventory items). A player can also hold and move objects within the game.

Author:
Alexander Poolton
Version:
8.0
Date:
5/8/2011

Member Function Documentation

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

Changes the player's health.

Parameters:
[in]_healthThe amount of health being added or subtracted from the player's current health.
IEnumerator Player::deathScreenDelay ( float  _timeDelay) [inline]

The amount of time the death screen is displayed for.

Parameters:
[in]_timeDelayThe time time delay before the death screen is disabled
void Player::displayObjectID ( RaycastHit  _objectHit) [inline]

Display the identify (name) of an object upon a the player's ray (the ray being cast by the player) hitting it.

Parameters:
[in]_objectHitThe hit information returned from the object being hit.
void Player::dropItem ( string  _itemName) [inline]

Drops the item, and removes the item from the player's inventory Note: This method is incomplete.

Parameters:
[in]_itemNameThe item's name
int Player::getHealth ( ) [inline]

Gets the player's current health.

Returns:
m_health The players current health.
bool Player::getIsObjectInLeftHand ( ) [inline]

Get if their is an object in the left hand or not.

Returns:
m_isObjectInLeftHand Returns whethere their is an item in the player's left hand or not.
bool Player::getIsObjectInRightHand ( ) [inline]

Get if their is an object in the right hand or not.

Returns:
m_isObjectInRightHand Returns whethere their is an item in the player's right hand or not.
Vector3 Player::getLeftHandPos ( ) [inline]

Get the position of the player's left hand.

Returns:
m_leftHandPos The player's left hand position
int Player::getNumberOfDeaths ( ) [inline]

Get the number of times the player has died.

Returns:
m_numberOfDeaths The player's current number of deaths.,
Vector3 Player::getRightHandPos ( ) [inline]

Get the position of the player's right hand.

Returns:
m_rightHandPos The player's right hand position
IEnumerator Player::meeleHitDelay ( int  _timeDelay) [inline]

The delay (or rate) at which between receiving melee damage (i.e. receive damge every x number of seconds). This is used to ensure the amount of damage received isn't exceptionally fast.

Parameters:
[in]_timeDelayThe time delay (in seconds) between receiving meele damage.
Returns:
yield The amount of time to yield (waits in seconds)
void Player::OnControllerColliderHit ( ControllerColliderHit  _hit) [inline]

Invoked if the player (it's collision capsule component) is hit with a meele attack hit (i.e. at close range, and is not shot).

Parameters:
[in]_hitThe object that collided with the player's controller collision capsule.
void Player::pickupItem ( string  _itemName,
GameObject  _item 
) [inline]

Pick up an item (the item must be of type inventory item)

Parameters:
[in]_itemNameThe item's name
[in]_itemThe item's gameobject
void Player::setIsObjectInLeftHand ( bool  _isInHand) [inline]

Set if there is an object in the left hand or not.

Parameters:
[in]_isInHandSets if there is an item in the hand or not.
void Player::setIsObjectInRightHand ( bool  _isInHand) [inline]

Set if there is an object in the right hand or not.

Parameters:
[in]_isInHandSets if there is an item in the hand or not.
void Player::setLastCheckpoint ( Vector3  _checkpoint) [inline]

Sets the players last checkpoint.

Parameters:
[in]_checkpointThe checkpoint
void Player::takeDamage ( string  _bodypartHit) [inline]

The player receives damage when being shot, or receiving a meele attack (which is the default case within this switch statement). The body part being hit will alter the amount of damage the player receives. Random ranges of damage are used for each body part, to ensure the damge is not extremely uniform (making it seem a bit more realistic).

Parameters:
[in]_bodypartHitThe body part being hit.

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