Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
Player Class Reference

#include <player.hpp>

Inheritance diagram for Player:
Creature Object

Public Member Functions

 Player (glm::vec3 corner, glm::vec3 facing)
 
 ~Player ()
 
virtual SharedObject toShared () override
 Generates a SharedObject representation of this object. More...
 
bool canBeTargetted () const
 
void setInvulnerableToLightning (bool isInvulnerable, double duration)
 This sets the Player as invulnerable to lightning and marks the timestamp for this event if the value is set to true. More...
 
bool isInvulnerableToLightning () const
 Getter for whether this Player is invulnerable to lightning. More...
 
double getLightningInvulnerabilityDuration () const
 Getter for this Player's lightning invulnerability duration (this value should be ignored if the Player's invulnerableToLightning boolean is false) More...
 
std::chrono::time_point< std::chrono::system_clock > getLightningInvulnerabilityStartTime () const
 Returns the timestamp for the last time that this Player became invulnerable to lightning. More...
 
- Public Member Functions inherited from Creature
 Creature (ObjectType type, glm::vec3 corner, glm::vec3 facing, ModelType modelType, SharedStats &&stats)
 
virtual ~Creature ()
 
virtual SharedObject toShared () override
 Generates a SharedObject representation of this object. More...
 
- Public Member Functions inherited from Object
 Object (ObjectType type, Physics physics, ModelType modelType)
 
virtual ~Object ()
 
void setModel (ModelType type)
 Sets this Object's model and initializes its dimensions to the given model's default dimensions. More...
 
virtual SharedObject toShared ()
 Generates a SharedObject representation of this object. More...
 
virtual void doCollision (Object *other, ServerGameState &state)
 Code to run when this object collides with another. More...
 
std::string to_string (unsigned int tab_offset)
 
std::string to_string ()
 

Data Fields

SharedPlayerInfo info
 
SharedInventory sharedInventory
 
SharedCompass compass
 
std::vector< SpecificIDinventory
 
- Data Fields inherited from Creature
SharedStats stats
 
SharedStatuses statuses
 
- Data Fields inherited from Object
EntityID globalID {}
 Unique object ID (used to index into the ServerGameState::objects vector) More...
 
SpecificID typeID {}
 Type-specific Object ID (used to index into the type-specific objects vector in ServerGameState) More...
 
MovableID movableID {}
 Movable ID (used to index into the movable objects vector in ServerGameState) More...
 
ObjectType type
 Identifies this object's type (derived class) More...
 
Physics physics
 Object's Physics-related properties. More...
 
ModelType modelType
 Object's render model type (specifies this Object's render model to the client) More...
 
AnimState animState
 Object's animation state and current action. For non-animated objects, this defaults as AnimState::IdleAnim. More...
 
bool is_sprinting
 used to determine if the player is sprinting for animation purposes More...
 
std::vector< glm::ivec2 > gridCellPositions
 Vector of (x, y) positions of GridCells currently occupied by this object. More...
 
float distance_moved
 Distance moved, for use in deciding when to play footsteps IMPORTANT: reset every time a footstep sound is performed for objects that play foosteps. More...
 

Additional Inherited Members

- Static Public Attributes inherited from Object
static std::unordered_map< ModelType, glm::vec3 > models
 Maps from ModelType to a model's dimensions as read from the model files. (At present, these values are hard-coded in object.cpp) More...
 

Constructor & Destructor Documentation

◆ Player()

Player::Player ( glm::vec3  corner,
glm::vec3  facing 
)
Parameters
Cornercorner position of the player
facingwhat direction the player should spawn in facing

◆ ~Player()

Player::~Player ( )

Member Function Documentation

◆ canBeTargetted()

bool Player::canBeTargetted ( ) const

◆ getLightningInvulnerabilityDuration()

double Player::getLightningInvulnerabilityDuration ( ) const

Getter for this Player's lightning invulnerability duration (this value should be ignored if the Player's invulnerableToLightning boolean is false)

Returns
double representing the number of seconds that this Player should be invulnerable to lightning since the lightning_invulnerability_start_time timestamp.

◆ getLightningInvulnerabilityStartTime()

std::chrono::time_point< std::chrono::system_clock > Player::getLightningInvulnerabilityStartTime ( ) const

Returns the timestamp for the last time that this Player became invulnerable to lightning.

Returns
std::chrono::time_point<std::chrono::system_clock> timestamp of the last time this Player became invulnerable to lightning.

◆ isInvulnerableToLightning()

bool Player::isInvulnerableToLightning ( ) const

Getter for whether this Player is invulnerable to lightning.

Returns
true if this Player is invulnerable to lightning and false otherwise.

◆ setInvulnerableToLightning()

void Player::setInvulnerableToLightning ( bool  isInvulnerable,
double  duration 
)

This sets the Player as invulnerable to lightning and marks the timestamp for this event if the value is set to true.

Parameters
isInvulnerablewhether the Player should now be invulnerable to lightning
durationhow long the Player should be invulnerable to lightning (ignored if isInvulnerable is false)

◆ toShared()

SharedObject Player::toShared ( )
overridevirtual

Generates a SharedObject representation of this object.

Returns
A SharedObject representation of this object.

Reimplemented from Creature.

Field Documentation

◆ compass

SharedCompass Player::compass

◆ info

SharedPlayerInfo Player::info

◆ inventory

std::vector<SpecificID> Player::inventory

◆ sharedInventory

SharedInventory Player::sharedInventory

The documentation for this class was generated from the following files: