#ifdef ASURA_USE_AXON
//////////////////////////////////////////////////////////////////////////////
//
// Axon_System.h
//
// Created by NJD - 16 August 2006
//
// Copyright (C) 2006 Rebellion, All Rights Reserved.
//
//////////////////////////////////////////////////////////////////////////////

// B E G I N   F I L E   W R A P P E R ///////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __AXON_SYSTEM_H__
#define __AXON_SYSTEM_H__ 1

// E N D   F I L E   W R A P P E R ///////////////////////////////////////////

// I N C L U D E S ///////////////////////////////////////////////////////////

// Asura
#include "Core/Asura_List.h"
#include "Core/Asura_Scheduler.h"

//////////////////////////////////////////////////////////////////////////////
//
// Axon_System
//
//////////////////////////////////////////////////////////////////////////////

class Axon_System
{
public:
	static void Initialise();
    static void Update();
    static void Shutdown();
	static void Reset();
    static void PostLoadInitialise();

    static void             RegisterBrain( class Axon_Brain* pxBrain )   { s_xBrainList.AddToList( pxBrain ); }
    static void             UnregisterBrain( class Axon_Brain* pxBrain ) { s_xBrainList.RemoveFromList( pxBrain ); }
    static Asura_Scheduler& GetBehaviourUpdateScheduler() { return s_xBehaviourUpdateScheduler; }
    static Asura_Scheduler& GetKnowledgeUpdateScheduler() { return s_xKnowledgeUpdateScheduler; }

    static class Axon_Sound_Registry* GetSoundRegistry() { return s_pxSoundRegistry; }
	static void	ClearSounds();

#if !defined(ASURA_NO_DEBUG_OUTPUT) && defined(ASURA_SUPPORT_COMMAND_CONSOLE)
	static bool ConsoleCmd_RenderActorGuid( u_int uGuid, bool bInterrogate, bool bHelp );
	static bool ConsoleCmd_RenderActorAll( bool bRender, bool bInterrogate, bool bHelp );
	static bool ConsoleCmd_RenderGS2( bool bRender, bool bInterrogate, bool bHelp );
	static bool ConsoleCmd_RenderNavWPs( bool bRender, bool bInterrogate, bool bHelp );
	static bool ConsoleCmd_RenderNavLinksAll( bool bRender, bool bInterrogate, bool bHelp );
	static bool ConsoleCmd_RenderNavLinksBlocked( bool bRender, bool bInterrogate, bool bHelp );
	static bool ConsoleCmd_RenderNavCoverpoints( bool bRender, bool bInterrogate, bool bHelp );
	static bool ConsoleCmd_RenderNavRange( float fRange, bool bInterrogate, bool bHelp );
	static bool ConsoleCmd_UpdateAI( bool bUpdate, bool bInterrogate, bool bHelp );
	static bool ConsoleCmd_RenderScheduler( bool bRender, bool bInterrogate, bool bHelp );
#endif

#ifndef ASURA_NO_DEBUG_OUTPUT
	static Asura_Guid GetRenderActorGuid() { return s_uRenderActorGuid; }
	static bool GetRenderActorAll() { return s_bRenderActorAll; }
	static bool GetRenderGS2() { return s_bRenderGS2; }
	static bool GetRenderNavWPs() { return s_bRenderNavWPs; }
	static bool GetRenderNavLinksAll() { return s_bRenderNavLinksAll; }
	static bool GetRenderNavLinksBlocked() { return s_bRenderNavLinksBlocked; }
	static bool GetRenderNavCoverpoints() { return s_bRenderNavCoverpoints; }
	static float GetRenderNavRangeSQ() { return s_fRenderNavRangeSQ; }
	static bool GetUpdateAI() { return s_bUpdateAI; }
	static bool GetRenderScheduler() { return s_bRenderScheduler; }
#endif

protected:
	Axon_System() { }
	virtual ~Axon_System() { }
	
    virtual void InitialiseThis();
    virtual void UpdateThis();
    virtual void ShutdownThis();
	virtual void ResetThis();
    virtual void PostLoadInitialiseThis();

    virtual class Axon_Sound_Registry* CreateSoundRegistry();
    virtual void DestroySoundRegistry( class Axon_Sound_Registry*& pxRegistry );

#ifndef ASURA_NO_DEBUG_OUTPUT
	virtual void DoRenderNavWPs();
	virtual void DoRenderNavLinks();
	virtual void DoRenderNavLinksBlocked();
	virtual void DoRenderNavCoverPoints();
	virtual void DoRenderGS2();
#ifdef ASURA_SCHEDULER_DEBUG
	virtual void DoRenderScheduler();
#endif
#endif

    static Axon_System* Project_CreateAxonSystem();

protected:
    static Axon_System*                   s_pxAxonSystem;
    static class Axon_Sound_Registry*     s_pxSoundRegistry;
    static Asura_List< class Axon_Brain > s_xBrainList;
    static Asura_Scheduler                s_xBehaviourUpdateScheduler;
    static Asura_Scheduler                s_xKnowledgeUpdateScheduler;

private:
#ifndef ASURA_NO_DEBUG_OUTPUT
	static u_int						  s_uRenderActorGuid;
	static bool							  s_bRenderActorAll;
	static bool							  s_bRenderGS2;
	static bool							  s_bRenderNavWPs;
	static bool							  s_bRenderNavLinksAll;
	static bool							  s_bRenderNavLinksBlocked;
	static bool							  s_bRenderNavCoverpoints;
	static float						  s_fRenderNavRangeSQ;
	static bool							  s_bUpdateAI;
	static bool							  s_bRenderScheduler;
#endif
};

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

#endif //__AXON_SYSTEM_H__
#endif
