HOG2
Public Member Functions | Private Attributes | List of all members
TeleportUnit Class Reference

A unit which randomly teleports around the world. More...

#include <RandomUnits.h>

Inheritance diagram for TeleportUnit:
Inheritance graph
[legend]
Collaboration diagram for TeleportUnit:
Collaboration graph
[legend]

Public Member Functions

 TeleportUnit (int x, int y, int _stayTime)
 
const char * GetName ()
 
bool MakeMove (MapEnvironment *, OccupancyInterface< xyLoc, tDirection > *, MapSimulationInfo *, tDirection &dir)
 make teleport move. More...
 
- Public Member Functions inherited from MapUnit
 MapUnit (int x, int y)
 
virtual void UpdateLocation (MapEnvironment *, xyLoc &l, bool, MapSimulationInfo *)
 
virtual void GetLocation (xyLoc &l)
 
virtual void OpenGLDraw (const MapEnvironment *, const MapSimulationInfo *) const
 
virtual void GetGoal (xyLoc &s)
 
- Public Member Functions inherited from Unit< xyLoc, tDirection, MapEnvironment >
 Unit ()
 
virtual ~Unit ()
 
virtual bool Done ()
 
virtual double GetSpeed ()
 
void SetSpeed (double s)
 
virtual void LogStats (StatCollection *)
 log an stats that may have been computed during the last run More...
 
virtual void LogFinalStats (StatCollection *)
 log any final one-time stats before a simulation is ended More...
 
virtual void SetColor (GLfloat _r, GLfloat _g, GLfloat _b)
 
virtual void GetColor (GLfloat &_r, GLfloat &_g, GLfloat &_b) const
 
UnitGroup< xyLoc, tDirection, MapEnvironment > * GetUnitGroup ()
 
void SetUnitGroup (UnitGroup< xyLoc, tDirection, MapEnvironment > *_group)
 
virtual unsigned int GetNum ()
 
virtual void SetNum (unsigned int num)
 
virtual void StartNewTrial (StatCollection *)
 
virtual int GetPriority ()
 
virtual void SetPriority (int val)
 

Private Attributes

int stayTime
 
int timer
 

Additional Inherited Members

- Protected Attributes inherited from MapUnit
GLfloat r
 
GLfloat g
 
GLfloat b
 
xyLoc loc
 

Detailed Description

A unit which randomly teleports around the world.

Definition at line 37 of file RandomUnits.h.

Constructor & Destructor Documentation

◆ TeleportUnit()

TeleportUnit::TeleportUnit ( int  x,
int  y,
int  _stayTime 
)
inline

Definition at line 39 of file RandomUnits.h.

Member Function Documentation

◆ GetName()

const char* TeleportUnit::GetName ( )
inlinevirtual

Implements Unit< xyLoc, tDirection, MapEnvironment >.

Definition at line 41 of file RandomUnits.h.

◆ MakeMove()

bool TeleportUnit::MakeMove ( MapEnvironment me,
OccupancyInterface< xyLoc, tDirection > *  ,
MapSimulationInfo ,
tDirection dir 
)
virtual

make teleport move.

the teleport unit stays put for some # moves, and then teleports to a new random location.

Implements Unit< xyLoc, tDirection, MapEnvironment >.

Definition at line 101 of file RandomUnits.cpp.

References MapEnvironment::GetMap(), Map::GetMapHeight(), Map::GetMapWidth(), kStay, kTeleport, stayTime, timer, loc::x, and loc::y.

Member Data Documentation

◆ stayTime

int TeleportUnit::stayTime
private

Definition at line 45 of file RandomUnits.h.

Referenced by MakeMove().

◆ timer

int TeleportUnit::timer
private

Definition at line 46 of file RandomUnits.h.

Referenced by MakeMove().


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