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 | Awake () |
| Initialises the players attributes (invokes one step before Start method)
|
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.
- Author:
- Alexander Poolton
- Version:
- 8.0
- Date:
- 5/8/2011