|
BWAPI
|
#include <GoalAction.h>


Public Member Functions | |
| GoalAction (Unit unit) | |
| bool | update (const Goal &squadGoal, const UnitGroup &squadUnitGroup) |
Definition at line 6 of file GoalAction.h.
| GoalAction::GoalAction | ( | Unit | unit | ) | [inline] |
Definition at line 9 of file GoalAction.h.
: SingleMicroActionBaseClass(unit) {}
| bool GoalAction::update | ( | const Goal & | squadGoal, |
| const UnitGroup & | squadUnitGroup | ||
| ) | [virtual] |
Implements SingleMicroActionBaseClass.
Definition at line 5 of file GoalAction.cpp.
References GoalTypeDef::Base, Goal::getBase(), UnitGroup::getClosestUnit(), Goal::getEngageUnits(), Goal::getGoalType(), Goal::getPosition(), Goal::getUnit(), SingleMicroActionBaseClass::mUnit, GoalTypeDef::Position, SafeEnum< def, inner >::underlying(), GoalTypeDef::Unit, and GoalTypeDef::UnitGroup.
{
switch(squadGoal.getGoalType().underlying())
{
case GoalType::Base:
{
Unit enemy = squadGoal.getBase()->getClosestEnemyBuilding(mUnit->getPosition());
if(enemy)
{
mUnit->move(enemy->getPosition(), 128);
return true;
}
else
{
mUnit->move(squadGoal.getBase()->getCenterLocation(), 128);
return true;
}
}
case GoalType::Position:
mUnit->move(squadGoal.getPosition(), 128);
return true;
case GoalType::Unit:
mUnit->move(squadGoal.getUnit()->getPosition(), 128);
return true;
case GoalType::UnitGroup:
mUnit->move(squadGoal.getEngageUnits().getClosestUnit(mUnit)->getPosition(), 128);
return true;
}
return false;
}
1.7.6.1