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

#ifdef AVP_USE_INPUT_SIMULATOR

// File's Header
#include "InputSimulator/AVP_InputSimulator_Predator.h"

// Asura
#include "Debugging/Asura_Assert.h"

// AVP
#include "InputSimulator/AVP_InputSimulator_Behaviour_Types.h"
#include "InputSimulator/AVP_InputSimulator_Behaviour.h"

AVP_InputSimulator_Behaviour* AVP_InputSimulator_Predator::m_xRootBehaviour = NULL;

void AVP_InputSimulator_Predator::Initialise()
{
	Asura_Assert( !m_xRootBehaviour, "AVP_InputSimulator_Predator is trying to initialise but is already initialised." );
	if( !m_xRootBehaviour )
	{
		m_xRootBehaviour = new AVP_InputSimulator_Behaviour();
		m_xRootBehaviour->CreateChildWithType( AVP_INPUTSIMULATOR_BEHAVIOUR_TYPE_PREDATOR_IDLE );
	}
}

void AVP_InputSimulator_Predator::Shutdown()
{
	Asura_Assert( m_xRootBehaviour, "AVP_InputSimulator_Predator has not been initialised and is trying to shutdown." );
	if( m_xRootBehaviour )
	{
		m_xRootBehaviour->DestroyAllChildren();
		delete m_xRootBehaviour;
		m_xRootBehaviour = NULL;
	}	
}

void AVP_InputSimulator_Predator::Update( u_char* ucCurrentInput, float* pfAxisValue )
{
	if( m_xRootBehaviour )
	{
		m_xRootBehaviour->UpdateBehaviours( ucCurrentInput, pfAxisValue );
	}
}

#endif // AVP_USE_INPUT_SIMULATOR
