#include "stdafx.h"
#include "../PerceptualState/PerceptualState.h"
#include "../SparAIContainer.h"
#include "PerceptualStateUnitData.h"
#include "UnitRecord/UnitRecordManager.h"
#include "UnitRecord/UnitRecord.h"

PerceptualStateUnitData::PerceptualStateUnitData(BWAPI::Unit* unit)
  : UnitData(unit)
  , m_unitRecord(*this, NULL)
{
}

void PerceptualStateUnitData::instantiateUnitRecord()
{
  assert(m_unitRecord == NULL);
  m_unitRecord = UnitRecordManager::instantiate(m_unit);
  Spar->getPerceptualState()->onUnitRecordCreate(m_unitRecord);
}

Region* PerceptualStateUnitData::getCurrentRegion() const
{
  Region* region = getUnitRecord()->getRegion();
  assert(region != NULL);
  return region;
}

