/**
*
* AVP_Attractors_System.h
*
* Created by GBT - 15 March 2007
*
* Copyright (C) 2006 Rebellion, All Rights Reserved.
*
**/

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __AVP_ATTRACTORS_SYSTEM_H__
#define __AVP_ATTRACTORS_SYSTEM_H__

// Includes

// core
#include "Attractors/Asura_Attractor_System.h"
#include "Core/Asura_Hash.h"
#include "Core/Asura_Maths.h"

#ifdef ASURA_TOOLS
#include "Attractors/Tools_Attractor_System.h"
#endif

//#define AVP_ENVHOOK_DEBUG_MODE 1

// Attractor types (partial).

static const Asura_Hash_ID uAVP_ATTRACTOR_TYPE_BRANCH	= 0xADAF25A2; //Asura_GetHashID("Branch");
static const Asura_Hash_ID uAVP_ATTRACTOR_TYPE_DUCT		= 0x002F38C2; //Asura_GetHashID("Duct");
static const Asura_Hash_ID uAVP_ATTRACTOR_TYPE_MANTLE	= 0xBF8AE553; //Asura_GetHashID("Mantle");
static const Asura_Hash_ID uAVP_ATTRACTOR_TYPE_PREDATOR_JUMP = 0x0fcc23a5; //Asura_GetHashID("PredatorJump");
static const Asura_Hash_ID uAVP_ATTRACTOR_TYPE_ALIEN_LEAP	= 0x65f57aaf; //Asura_GetHashID("AlienLeap");
static const Asura_Hash_ID uAVP_ATTRACTOR_TYPE_ALIEN_AI_JUMP = 0xabf8d1dd; //Asura_GetHashID("AlienAIJump");
static const Asura_Hash_ID uAVP_ATTRACTOR_TYPE_ALIEN_AI_JUMP_OVER = 0x7d86d831; //Asura_GetHashID("AlienAIJumpOver");


// Forward Declarations

class Asura_Attractor_Compiled;
class Asura_Blueprint;
template < typename T > class Asura_TemplateHashTree;
class AVP_ServerEntity_Actor;

//////////////////////////////////////////////////////////////////////////////
//
// AVP_Attractors_System
//
//////////////////////////////////////////////////////////////////////////////

class AVP_Attractor_ProjectData
{
public:
    AVP_Attractor_ProjectData() {}
    virtual ~AVP_Attractor_ProjectData() {}
    void Initialise( const Asura_Attractor_Compiled& xAttractor );

protected:
    virtual void InitialiseFromBlueprint( Asura_Blueprint& xBlueprint );
};

class AVP_Attractors_System
{
public:
    static void Initialise();
    static void Shutdown();

    static bool GetHorizontalAttractorBestPosition( const Asura_Vector_3& xPosition, const Asura_Attractor_Compiled& xEnvHook, Asura_Vector_3& xBestPosition );
    static AVP_Attractor_ProjectData* GetAttractorProjectData( const Asura_Attractor_Compiled& xEnvHook );

#ifdef ASURA_TOOLS
	static void Tools_Initialise();
    static void Tools_Update();
	static void Tools_Render();
    static void UpdateAttractorTypes();
#endif

private:
	static const Asura_Angle s_fMaxAngleToEnvHook;
    static Asura_TemplateHashTree< AVP_Attractor_ProjectData* > s_xProjectDataTree;

#ifdef ASURA_TOOLS
    static float s_fAttractorTypeUpdateTimer;
    static bool  s_bToolsInitialised;
#endif
};

//////////////////////////////////////////////////////////////////////////////
//
// 
//
//////////////////////////////////////////////////////////////////////////////

#endif//__AVP_ATTRACTORS_SYSTEM_H__
