|
BWAPI
|
#include <ObserverScoutTask.h>


Public Member Functions | |
| ObserverScoutTask (TaskType priority, ScoutData data) | |
| virtual int | getEndTime () const |
| virtual int | getEndTime (Unit unit) const |
| virtual int | getPriority (Unit unit) const |
| virtual Position | getStartLocation (Unit unit) const |
| virtual Position | getEndLocation (Unit unit) const |
| virtual bool | preUpdate () |
| virtual bool | update () |
| virtual void | updateRequirements () |
| virtual bool | waitingForUnit (Unit unit) const |
| virtual void | giveUnit (Unit unit) |
| virtual void | returnUnit (Unit unit) |
| virtual bool | morph (Unit unit, BWAPI::UnitType previousType) |
| virtual UnitGroup | getFinishedUnits () |
| virtual std::string | getTaskName () const |
| virtual std::string | getOutputName () const |
Private Attributes | |
| Unit | mUnit |
| Behaviour | mUnitBehaviour |
| ScoutData | mData |
Definition at line 12 of file ObserverScoutTask.h.
| ObserverScoutTask::ObserverScoutTask | ( | TaskType | priority, |
| ScoutData | data | ||
| ) |
Definition at line 4 of file ObserverScoutTask.cpp.
| Position ObserverScoutTask::getEndLocation | ( | Unit | unit | ) | const [virtual] |
| int ObserverScoutTask::getEndTime | ( | ) | const [virtual] |
Implements Task.
Definition at line 10 of file ObserverScoutTask.cpp.
References Requirement::maxTime.
Referenced by getEndTime().
{
return Requirement::maxTime;
}

| int ObserverScoutTask::getEndTime | ( | Unit | unit | ) | const [virtual] |
Implements Task.
Definition at line 15 of file ObserverScoutTask.cpp.
References getEndTime().
{
return getEndTime();
}

| UnitGroup ObserverScoutTask::getFinishedUnits | ( | ) | [virtual] |
Implements Task.
Definition at line 116 of file ObserverScoutTask.cpp.
References UnitGroup::insert(), and mUnit.

| virtual std::string ObserverScoutTask::getOutputName | ( | ) | const [inline, virtual] |
| int ObserverScoutTask::getPriority | ( | Unit | unit | ) | const [virtual] |
| Position ObserverScoutTask::getStartLocation | ( | Unit | unit | ) | const [virtual] |
| virtual std::string ObserverScoutTask::getTaskName | ( | ) | const [inline, virtual] |
| void ObserverScoutTask::giveUnit | ( | Unit | unit | ) | [virtual] |
Implements Task.
Definition at line 94 of file ObserverScoutTask.cpp.
References mUnit, mUnitBehaviour, and Behaviour::set().
{
mUnit = unit;
mUnitBehaviour.set(unit);
}

| bool ObserverScoutTask::morph | ( | Unit | unit, |
| BWAPI::UnitType | previousType | ||
| ) | [virtual] |
| bool ObserverScoutTask::preUpdate | ( | ) | [virtual] |
Implements Task.
Definition at line 41 of file ObserverScoutTask.cpp.
References Singleton< T >::Instance(), mData, and mUnit.
{
if(mData && mData->isAchieved())
mData.reset();
if(mUnit && !mData)
mData = ScoutManager::Instance().getScoutData(ScoutUnitType::Observer);
return false;
}

| void ObserverScoutTask::returnUnit | ( | Unit | unit | ) | [virtual] |
Implements Task.
Definition at line 100 of file ObserverScoutTask.cpp.
References Task::complete(), ScoutTypeDef::FailedWithAir, Singleton< T >::Instance(), mData, mUnit, mUnitBehaviour, StaticUnits::nullunit, and Behaviour::onDeleted().
{
if(!mUnit->exists() && mData)
ScoutManager::Instance().updateLastScoutType(mData, ScoutType::FailedWithAir);
complete();
mUnit = StaticUnits::nullunit;
mUnitBehaviour.onDeleted();
}

| bool ObserverScoutTask::update | ( | ) | [virtual] |
Implements Task.
Definition at line 52 of file ObserverScoutTask.cpp.
References ActionTypeDef::FallBack, Goal::getGoalType(), Task::hasEnded(), mData, mUnit, mUnitBehaviour, BWAPI::BulletTypes::None, and Behaviour::update().
{
if(mUnit)
{
Goal observerGoal;
if(mData)
observerGoal = Goal(ActionType::FallBack, mData->getNextPosition(mUnit->getPosition()));
if(observerGoal.getGoalType() == GoalType::None)
{
;//TODO: go to closest cloaked enemy unit
//TODO: go to closest enemy scv that is in the fog
}
mUnitBehaviour.update(observerGoal, UnitGroup());
}
return hasEnded() && !mUnit;
}

| void ObserverScoutTask::updateRequirements | ( | ) | [virtual] |
Reimplemented from Task.
Definition at line 73 of file ObserverScoutTask.cpp.
References Task::addRequirement(), RequirementGroup::addUnitFilterRequirement(), Task::clearRequirements(), UnitFilterFlags::IsComplete, Requirement::maxTime, mData, mUnit, BWAPI::UnitTypes::Protoss_Observer, and Task::shouldReturnUnit().
{
clearRequirements();
if(!mUnit && !shouldReturnUnit())
{
RequirementGroup requirementOne;
if(mData)
requirementOne.addUnitFilterRequirement(10, Requirement::maxTime, UnitFilter(BWAPI::UnitTypes::Protoss_Observer) && UnitFilter(UnitFilterFlags::IsComplete), mData->getNextPosition());
else
requirementOne.addUnitFilterRequirement(10, Requirement::maxTime, UnitFilter(BWAPI::UnitTypes::Protoss_Observer) && UnitFilter(UnitFilterFlags::IsComplete));
addRequirement(requirementOne);
}
}

| bool ObserverScoutTask::waitingForUnit | ( | Unit | unit | ) | const [virtual] |
ScoutData ObserverScoutTask::mData [private] |
Definition at line 43 of file ObserverScoutTask.h.
Referenced by getEndLocation(), getStartLocation(), preUpdate(), returnUnit(), update(), and updateRequirements().
Unit ObserverScoutTask::mUnit [private] |
Definition at line 40 of file ObserverScoutTask.h.
Referenced by getFinishedUnits(), giveUnit(), preUpdate(), returnUnit(), update(), and updateRequirements().
Behaviour ObserverScoutTask::mUnitBehaviour [private] |
Definition at line 41 of file ObserverScoutTask.h.
Referenced by giveUnit(), returnUnit(), and update().
1.7.6.1