#pragma once
#include "UnitDynamicLocation.h"
#include "../Static/Shape/CircularLocation.h"

/**
 * @brief Dynamic location representing a moving circle centered at a given unit's position.
 */
class UnitCircularLocation : public UnitDynamicLocation
{
public:
  UnitCircularLocation(UnitRecord* unit, int radius)
    : UnitDynamicLocation(unit)
    , m_radius(radius)
  {
  }

  UnitCircularLocation(UnitRecord* unit)
    : UnitDynamicLocation(unit)
    , m_radius(DANGER_DISTANCE)
  {
  }

  CircularLocation getCircularLocation() const
  {
    return CircularLocation(m_unit->getPosition(), m_radius);
  }

  virtual BWAPI::Position getCurrentCenter() const
  {
    return getCircularLocation().getCurrentCenter();
  }

  virtual bool isInLocation(BWAPI::Position position) const
  {
    return getCircularLocation().isInLocation(position);
  }

  virtual bool isInLocation(BWAPI::TilePosition tile) const
  {
    return getCircularLocation().isInLocation(tile);
  }

protected:
  virtual void _output(std::ostream& out) const
  {
    out << "Unit circular location " << *m_unit << " (" << m_radius << ")";
  }

  const int m_radius;
};