RodinBTNode::ETickStatus RodinBTNodeSendEvent::Tick( float DeltaTime )
{
	Unused( DeltaTime );

	WBEntity* const pEntity = GetEntity();

	WBEvent Event;

	Event.SetEventName( m_EventName );

	if( pEntity )
	{
		pEntity->AddContextToEvent( Event );
	}

	WBParamEvaluator::SPEContext PEContext;
	PEContext.m_Entity = pEntity;

	const uint NumParameters = m_Parameters.Size();
	for( uint ParameterIndex = 0; ParameterIndex < NumParameters; ++ParameterIndex )
	{
		SNamedParameter& Parameter = m_Parameters[ ParameterIndex ];
		Parameter.m_ValuePE.Evaluate( PEContext );
		Event.Set( Parameter.m_Name, Parameter.m_ValuePE );
	}

	m_RecipientPE.Evaluate( PEContext );

	if( m_QueueEvent )
	{
		WBWorld::GetInstance()->GetEventManager()->QueueEvent( Event, m_RecipientPE.GetEntity(), m_DispatchDelay );
	}
	else
	{
		WBWorld::GetInstance()->GetEventManager()->DispatchEvent( Event, m_RecipientPE.GetEntity() );
	}

	return ETS_Success;
}
void AnimEventEldSendEvent::Call( Mesh* pMesh, Animation* pAnimation )
{
	Unused( pAnimation );

	EldritchMesh* const pEldritchMesh = static_cast<EldritchMesh*>( pMesh );
	WBEntity* const pEntity = pEldritchMesh->GetEntity();

	WBEvent Event;

	Event.SetEventName( m_EventName );

	if( pEntity )
	{
		pEntity->AddContextToEvent( Event );
	}

	WBParamEvaluator::SPEContext PEContext;
	PEContext.m_Entity = pEntity;

	const uint NumParameters = m_Parameters.Size();
	for( uint ParameterIndex = 0; ParameterIndex < NumParameters; ++ParameterIndex )
	{
		SNamedParameter& Parameter = m_Parameters[ ParameterIndex ];
		Parameter.m_ValuePE.Evaluate( PEContext );
		Event.Set( Parameter.m_Name, Parameter.m_ValuePE );
	}

	if( m_QueueEvent )
	{
		WBWorld::GetInstance()->GetEventManager()->QueueEvent( Event, pEntity, m_DispatchDelay );
	}
	else
	{
		WBWorld::GetInstance()->GetEventManager()->DispatchEvent( Event, pEntity );
	}
}