#ifndef _HPP_KUNGFLOW_CHARACTER_AICONTROLLER
#define _HPP_KUNGFLOW_CHARACTER_AICONTROLLER

#include "../character_controller.hpp"

#include <boost/signals2.hpp>

class KungFlowGame;
class PlayState;
class Stage;
class CharacterModelView;
class Character;

class CharacterAIController : public CharacterController {

  public:

    CharacterAIController(const KungFlowGame *game, const PlayState *playState, const Character *character);
    virtual ~CharacterAIController();

    virtual void OnStepPhysicsTime(CharacterModelView *characterModelView);

  protected:

    const Character *character;

    Character *closestOpponent;
    Character *assignedOpponent;
    std::vector<Character*> closestOpponents;
    std::vector<Character*> closestMates;

    float randomSeed;

    // cache
    void UpdateCaches();
    unsigned int timeSinceLastUpdate_ms;
    unsigned int updateInterval_ms;
    // cached stuff:
    int nthClosestToAssignedOpponent;
    std::vector<Character*> assignedOpponents;

  private:

    boost::signals2::connection personnelChangeConnection;

};

#endif
