Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
|
#include <spiketrap.hpp>
Public Member Functions | |
SpikeTrap (glm::vec3 corner, glm::vec3 dimensions) | |
bool | shouldTrigger (ServerGameState &state) override |
void | trigger (ServerGameState &state) override |
bool | shouldReset (ServerGameState &state) override |
void | reset (ServerGameState &state) override |
void | doCollision (Object *other, ServerGameState &state) override |
Code to run when this object collides with another. More... | |
![]() | |
Trap (ObjectType type, bool movable, glm::vec3 corner, Collider collider, ModelType model, glm::vec3 dimensions=glm::vec3(1.0f)) | |
virtual bool | shouldTrigger (ServerGameState &state)=0 |
virtual void | trigger (ServerGameState &state) |
virtual bool | shouldReset (ServerGameState &state)=0 |
virtual void | reset (ServerGameState &state) |
SharedObject | toShared () override |
Generates a SharedObject representation of this object. More... | |
void | setIsDMTrap (bool is_dm_trap) |
void | setIsDMTrapHover (bool is_dm_trap_hover) |
void | setExpiration (std::chrono::time_point< std::chrono::system_clock > expiration) |
bool | getIsDMTrap () |
std::chrono::time_point< std::chrono::system_clock > | getExpiration () |
![]() | |
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 () |
Static Public Attributes | |
static const int | DAMAGE = 9999 |
static const std::chrono::seconds | ACTIVE_TIME = 4s |
static const std::chrono::seconds | TIME_UNTIL_RESET = 10s |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
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... | |
![]() | |
bool | is_dm_trap |
std::chrono::time_point< std::chrono::system_clock > | expiration |
SharedTrapInfo | info |
Spike trap which falls from the ceiling if a player walks underneath
SpikeTrap::SpikeTrap | ( | glm::vec3 | corner, |
glm::vec3 | dimensions | ||
) |
corner | Corner position of the spike trap |
dimensions | dimensions of the spike trap (probably will change once we use a non cube model to not have this) |
|
overridevirtual |
Code to run when this object collides with another.
NOTE: default implementation does nothing only override behaviors will matter
Reimplemented from Object.
|
overridevirtual |
Logic to reset the trap
At the highest level, this version just sets the triggered flag to false. Derivations of this should do additional resetting logic, and potentially call this Base class version as well to reset the common logic for all traps (currently just the triggered variable)
state | GameState in case the trap needs to use the state for that |
Reimplemented from Trap.
|
overridevirtual |
Resets the trap
state | GameState, in case you need that to determine if the trap should reset |
Implements Trap.
|
overridevirtual |
Determines if the trap should be triggered
state | GameState, in case you need that to determine if the trap should trigger |
Implements Trap.
|
overridevirtual |
Activates the trap
At the highest level, this just sets the triggered variable to true. Subclass versions of this will also probably want to call this function to set the triggered variable, in addition to any other common flags we add in later.
state | State in case triggering the trap needs to affect the gamestate |
Reimplemented from Trap.
|
static |
|
static |
|
static |