void CActorAnimationActionCooperative::OnEntityEvent(IEntity* pEntity, const SEntityEvent& event)
{
	if (!pEntity)
		return;

	const EntityId entityId = pEntity->GetId();
	if (entityId == m_targetEntityId)
	{
		// Cleaning the slave context currently /immediately/ flush scopes using
		// it, which means WE will get flushed too. In that case we will get a
		// Release() call. By adding a reference to ourselves we prevent ourselves
		// from being deleted in flight.
		AddRef();

		if (m_eStatus == Pending)
		{
			// In the unlikely event we didn't even start yet, make sure to send the
			// event that tells the rest of the code we finished
			SendStateEventCoopAnim();

			ForceFinish();
		}
		else if (m_eStatus == Installed)
		{
			// Note: Cleaning the slave context will cause Exit() to be called on ourselves
			RemoveTargetFromSlaveContext();
		}

		// Release ourselves after we cleaned up (this might cause ourselves to be deleted)
		Release();
	}
}
void CActorAnimationActionCooperative::Exit()
{
	CAnimationAction::Exit();

	SendStateEventCoopAnim();

	//if (auto pAnimChar = m_sourceActor.GetAnimatedCharacter())
	//{
	//	pAnimChar->SetMovementControlMethods(eMCM_Entity, eMCM_Entity);
	//	pAnimChar->ForceRefreshPhysicalColliderMode();
	//	pAnimChar->RequestPhysicalColliderMode(eColliderMode_Undefined, eColliderModeLayer_Game, "CActorAnimationActionCooperative::Exit()");
	//}

	//if (m_pTargetActor)
	//{
	//	if (auto pAnimCharTarget = m_pTargetActor->GetEntityId() ? m_pTargetActor->GetAnimatedCharacter() : nullptr)
	//	{
	//		pAnimCharTarget->SetMovementControlMethods(eMCM_Entity, eMCM_Entity);
	//		pAnimCharTarget->ForceRefreshPhysicalColliderMode();
	//		pAnimCharTarget->RequestPhysicalColliderMode(eColliderMode_Undefined, eColliderModeLayer_Game, "CActorAnimationActionCooperative::Exit()");
	//	}
	//}

	RemoveTargetFromSlaveContext();
}
Пример #3
0
void CActionCoopAnimation::Exit()
{
	SendStateEventCoopAnim();

	TPlayerAction::Exit();

	IAnimatedCharacter* pAnimChar = m_player.GetAnimatedCharacter();
	IAnimatedCharacter* pAnimCharTarget = m_targetEntityID ? m_target.GetAnimatedCharacter() : NULL;

	if( pAnimChar )
	{
		pAnimChar->SetMovementControlMethods(eMCM_Entity, eMCM_Entity);
		pAnimChar->ForceRefreshPhysicalColliderMode();
		pAnimChar->RequestPhysicalColliderMode(eColliderMode_Undefined, eColliderModeLayer_Game, "CActionStealthKill::Exit()");
	}
	if (pAnimCharTarget)
	{
		pAnimCharTarget->SetMovementControlMethods(eMCM_Entity, eMCM_Entity);
		pAnimCharTarget->ForceRefreshPhysicalColliderMode();
		pAnimCharTarget->RequestPhysicalColliderMode(eColliderMode_Undefined, eColliderModeLayer_Game, "CActionStealthKill::Exit()");
	}

	RemoveTargetFromSlaveContext();

	m_player.PartialAnimationControlled( false, PlayerCameraAnimationSettings());
	m_player.GetActorStats()->animationControlledID = 0;
	m_player.HolsterItem(false);

	// Update visibility to change render mode of 1st person character
	m_player.RefreshVisibilityState();
}