BTHAI 2.3
Public Member Functions | Static Public Attributes
WorkerAgent Class Reference

#include <WorkerAgent.h>

Inheritance diagram for WorkerAgent:
BaseAgent

List of all members.

Public Member Functions

 WorkerAgent (Unit *mUnit)
void computeActions ()
string getTypeName ()
void setState (int state)
int getState ()
bool canBuild (UnitType type)
bool assignToRepair (Unit *building)
bool assignToBuild (UnitType type)
bool assignToFinishBuild (Unit *building)
string getStateAsText ()
void destroyed ()
void reset ()
bool isConstructing (UnitType type)

Static Public Attributes

static const int GATHER_MINERALS = 0
static const int GATHER_GAS = 1
static const int FIND_BUILDSPOT = 2
static const int MOVE_TO_SPOT = 3
static const int CONSTRUCT = 4
static const int REPAIRING = 5
static const int ATTACKING = 6

Detailed Description

The WorkerAgent class handles all tasks that a worker, for example a Terran SCV, can perform. The tasks involves gathering minerals and gas, move to a selected buildspot and construct the specified building, and if Terran SCV, repair a building or tank.

Author: Johan Hagelback (johan.hagelback@gmail.com)


Constructor & Destructor Documentation

WorkerAgent::WorkerAgent ( Unit *  mUnit)

Constructor.


Member Function Documentation

bool WorkerAgent::assignToBuild ( UnitType  type) [virtual]

Assigns the unit to construct a building of the specified type.

Reimplemented from BaseAgent.

bool WorkerAgent::assignToFinishBuild ( Unit *  building) [virtual]

Assigns the agent to continue building a non-finished building.

Reimplemented from BaseAgent.

bool WorkerAgent::assignToRepair ( Unit *  building) [virtual]

Assigns the agent to repair a building or tank.

Reimplemented from BaseAgent.

bool WorkerAgent::canBuild ( UnitType  type) [virtual]

Returns true if the Worker agent can create units of the specified type.

Reimplemented from BaseAgent.

void WorkerAgent::computeActions ( ) [virtual]

Called each update to issue orders.

Reimplemented from BaseAgent.

void WorkerAgent::destroyed ( ) [virtual]

Called when the unit assigned to this agent is destroyed.

Reimplemented from BaseAgent.

int WorkerAgent::getState ( )

Returns the current state of the worker.

string WorkerAgent::getStateAsText ( )

Returns the state of the agent as text. Good for printouts.

string WorkerAgent::getTypeName ( ) [virtual]

Returns the unique type name for worker agents.

Reimplemented from BaseAgent.

bool WorkerAgent::isConstructing ( UnitType  type)

Returns true if this worker is in any of the build states, and is constructing the specified building.

void WorkerAgent::reset ( )

Resets a worker to gathering minerals.

void WorkerAgent::setState ( int  state)

Set the state of the worker. I.e. what does it do right now. Should only be set if the worker is getting a task not through the functions in this class. Then it is automatic.


Member Data Documentation

const int WorkerAgent::ATTACKING = 6 [static]

Worker is needed to attack an enemy intruder in a base.

const int WorkerAgent::CONSTRUCT = 4 [static]

Worker is constructing a building.

const int WorkerAgent::FIND_BUILDSPOT = 2 [static]

Worker is trying to find a buildspot for a requested building.

const int WorkerAgent::GATHER_GAS = 1 [static]

Worker is gathering gas.

const int WorkerAgent::GATHER_MINERALS = 0 [static]

Worker is gathering minerals.

const int WorkerAgent::MOVE_TO_SPOT = 3 [static]

Worker is moving to a found buildspot.

const int WorkerAgent::REPAIRING = 5 [static]

Worker is repairing a building (Terran only).


The documentation for this class was generated from the following files:
 All Classes Functions Variables