duncan
Mom and Dad were wrong!
|
#include <npc.h>
Public Types | |
typedef std::vector< std::pair < size_t, size_t > > | path_t |
Duplicated with client...! | |
Public Member Functions | |
NPC (std::pair< size_t, size_t >, std::pair< size_t, size_t >) | |
void | update () |
size_t | destr () |
size_t | destc () |
void | set_path (const path_t &) |
void | set_path (const std::list< std::pair< size_t, size_t > > &) |
bool | should_snap () |
std::pair< double, double > | desired_pos () |
void | snapped () |
Public Attributes | |
double | last_path_send |
Represents a non-player character.
see LICENSE
NPC::NPC | ( | std::pair< size_t, size_t > | start, |
std::pair< size_t, size_t > | end | ||
) |
Set the two route waypoints for this NPC.
start | initial waypoint |
end | final waypoint |
std::pair< double, double > NPC::desired_pos | ( | ) |
size_t NPC::destc | ( | ) |
size_t NPC::destr | ( | ) |
void NPC::set_path | ( | const std::list< std::pair< size_t, size_t > > & | path | ) |
Tells this NPC to start following the given path.
bool NPC::should_snap | ( | ) |
void NPC::snapped | ( | ) |
Please call this after setting this NPC's position to desired_pos() please.
void NPC::update | ( | ) |
Makes this NPC follow his path. Must be called frequently enough to prevent overshooting by >kTolerance, but as long as NPCs are quite slow, this shouldn't be very demanding...