Wing 323 - Gamepad Version
V1.0
|
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...
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. |
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.
void Player::changeHealth | ( | int | _health | ) | [inline] |
Changes the player's health.
[in] | _health | The 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.
[in] | _timeDelay | The 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.
[in] | _objectHit | The 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.
[in] | _itemName | The item's name |
int Player::getHealth | ( | ) | [inline] |
Gets the player's current health.
bool Player::getIsObjectInLeftHand | ( | ) | [inline] |
Get if their is an object in the left hand or not.
bool Player::getIsObjectInRightHand | ( | ) | [inline] |
Get if their is an object in the right hand or not.
Vector3 Player::getLeftHandPos | ( | ) | [inline] |
Get the position of the player's left hand.
int Player::getNumberOfDeaths | ( | ) | [inline] |
Get the number of times the player has died.
Vector3 Player::getRightHandPos | ( | ) | [inline] |
Get the position of the player's right hand.
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.
[in] | _timeDelay | The time delay (in seconds) between receiving meele damage. |
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).
[in] | _hit | The 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)
[in] | _itemName | The item's name |
[in] | _item | The item's gameobject |
void Player::setIsObjectInLeftHand | ( | bool | _isInHand | ) | [inline] |
Set if there is an object in the left hand or not.
[in] | _isInHand | Sets 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.
[in] | _isInHand | Sets if there is an item in the hand or not. |
void Player::setLastCheckpoint | ( | Vector3 | _checkpoint | ) | [inline] |
Sets the players last checkpoint.
[in] | _checkpoint | The 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).
[in] | _bodypartHit | The body part being hit. |