void AnimEventEldExecuteAction::Call( Mesh* pMesh, Animation* pAnimation )
{
	Unused( pMesh );
	Unused( pAnimation );

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

	WBEvent OnAnimEventEvent;
	STATIC_HASHED_STRING( OnAnimEvent );
	OnAnimEventEvent.SetEventName( sOnAnimEvent );
	pEntity->AddContextToEvent( OnAnimEventEvent );

	const uint NumActions = m_Actions.Size();
	for( uint ActionIndex = 0; ActionIndex < NumActions; ++ActionIndex )
	{
		WBAction* const pAction = m_Actions[ ActionIndex ];
		ASSERT( pAction );

		WBActionStack::Push( OnAnimEventEvent );
		pAction->Execute();
		WBActionStack::Pop();
	}
}
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;
}
Exemplo n.º 3
0
RodinBTNode::ETickStatus RodinBTNodePlayActions::Tick(float DeltaTime) {
  Unused(DeltaTime);

  WBEntity* const pEntity = GetEntity();

  WBEvent BTNodePlayActionsEvent;
  STATIC_HASHED_STRING(BTNodePlayActionsEvent);
  BTNodePlayActionsEvent.SetEventName(sBTNodePlayActionsEvent);
  pEntity->AddContextToEvent(BTNodePlayActionsEvent);

  const uint NumActions = m_Actions.Size();
  for (uint ActionIndex = 0; ActionIndex < NumActions; ++ActionIndex) {
    WBAction* const pAction = m_Actions[ActionIndex];
    ASSERT(pAction);

    WBActionStack::Push(BTNodePlayActionsEvent);
    pAction->Execute();
    WBActionStack::Pop();
  }

  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 );
	}
}