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

/**
 * @brief Dynamic location representing the moving position of a given unit record.
 */
class UnitCoordinatesLocation : public UnitDynamicLocation
{
public:
  UnitCoordinatesLocation(UnitRecord* unit)
    : UnitDynamicLocation(unit)
  {
  }

  CoordinatesLocation getCoordinatesLocation() const
  {
    return CoordinatesLocation(m_unit->getPosition());
  }

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

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

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

protected:
  virtual void _output(std::ostream& out) const
  {
    out << "Unit coordinates " << *m_unit << " (" << m_unit->getPosition() << ")";
  }
};