Example #1
0
void UFloatingTextWidget::SpawnAtPosition(UObject* worldContextObject, FVector2D screenPosition, FString message, FLinearColor textColor /*= FLinearColor::White*/)
{
	if (!IsGameRunning(worldContextObject)) return;

	auto widget = Create(worldContextObject, message, textColor);

	GetSlot(widget->messageLabel)->SetPosition(screenPosition / GetViewportScale());
}
Example #2
0
void UFloatingTextWidget::SpawnAtActor(UObject* worldContextObject, AActor* targetActor, FString message, FVector offset /*= FVector::ZeroVector*/, FLinearColor textColor /*= FLinearColor::White*/)
{
	if (!IsGameRunning(worldContextObject)) return;

	auto widget = Create(worldContextObject, message, textColor);

	FVector2D screenPos;
	widget->MasterController->ProjectWorldLocationToScreen(targetActor->GetActorLocation() + offset, screenPos);
	GetSlot(widget->messageLabel)->SetPosition(screenPos / GetViewportScale());
}
Example #3
0
void GameLogic::StartGame(MainScene* s)
{
	if (m_bInit)
	{
		return;
	}

	m_pMainScene = s;

	// 初始化英雄人物
	if(!HeroManager::GetInstance()->InitHero())
	{
		return; 
	}

	// 设置玩家的英雄的ID
	m_Player->SetHeroID(HeroManager::GetInstance()->GetCurrentHero()->GetHeroID());

	if (GetGameType() == SINGLE_GAME_TYPE)
	{
		m_Player->SetUserID("Player");
	}

	if (GetGameType() == CREATE_GAME_TYPE)
	{
		m_Player->SetIsCreator(true);
	}

	if (GetGameType() == JOIN_GAME_TYPE)
	{
		m_Player->SetIsCreator(false);
	}

	m_bInit = true;

	// 设置运行标志
	IsGameRunning(true);

	MagicManager::GetInstance()->ShowLamp();

}