void UHealthBar::AddToCreep() { if (!GetIsVisible()) { AddToViewport(); } ABasicCreep *creep = Cast<ABasicCreep>(GetOwningPlayerPawn()); if (creep) { hp = (float)creep->GetHP() / (float)creep->GetHP(); } }
//called by the blueprint widget when server clicks the start game button. void ULobby_Widget::InvertYAxis() { AMainPlayerController* PC = Cast<AMainPlayerController>(GetOwningPlayerPawn()->Controller); PC->PlayerInput->InvertAxis("Pitch"); }
FText UMyPlayerAmmoWidget::GetAmmo() const { AMyCharacter* MyCharacter = Cast<AMyCharacter>(GetOwningPlayerPawn()); return FText::FromString(FString::FromInt(MyCharacter->Data("Ammo"))); }