void AFPSHorrorCharacter::HealthDecay(float DeltaTime) { if (Health <= 0) { const FString Message = "You Died"; GEngine->AddOnScreenDebugMessage(1, 2, FColor::Red, Message); LoadMainMenu(); return; } Health -= DeltaTime * DecayingRate; }
void GUIManager::StateChange() { if(mCurrentState==MAIN_MENU) sheet->removeChildWindow("mainMenu"); mCurrentState = GAMEENGINE.GetStateManager()->GetCurrentState(); if(GAMEENGINE.GetStateManager()->GetCurrentState() == MAIN_MENU) LoadMainMenu(); if(GAMEENGINE.GetStateManager()->GetCurrentState() == PLAYING_LEVEL) { LoadInventory(); LoadInventorySpaces(); InitializeInventory(); LoadCharacterSheet(); LoadCharacterSheetSlots(); InitializeCharacterSheet(); } }
void AFPSHorrorCharacter::ShootBloodBall() { Health -= 10; if (Health <= 0) { LoadMainMenu(); } if (ProjectileClass != NULL) { const FRotator SpawnRotation = GetControlRotation(); // MuzzleOffset is in camera space, so transform it to world space before offsetting from the character location to find the final muzzle position //const FVector SpawnLocation = GetActorLocation() + SpawnRotation.RotateVector(GunOffset); const FVector SpawnLocation = GetActorLocation(); UWorld* const World = GetWorld(); if (World != NULL) { // spawn the projectile at the muzzle World->SpawnActor<AFPSHorrorProjectile>(ProjectileClass, SpawnLocation, SpawnRotation); } } }