// Fill out your copyright notice in the Description page of Project Settings. #include "BlasterPlayerState.h" #include "Blaster/Character/BlasterCharacter.h" #include "Blaster/PlayerController/BlasterPlayerController.h" void ABlasterPlayerState::IncreaseScore(float ScoreAmount) { SetScore(GetScore() + ScoreAmount); Character = GetCharacter(); if (Character) { Controller = GetController(); if (Controller) { Controller->SetHUDScore(GetScore()); } } } void ABlasterPlayerState::OnRep_Score() { Super::OnRep_Score(); Character = GetCharacter(); if (Character) { Controller = GetController(); if (Controller) { Controller->SetHUDScore(GetScore()); } } } ABlasterCharacter* ABlasterPlayerState::GetCharacter() const { return Character == nullptr ? Cast(GetPawn()) : Character; } ABlasterPlayerController* ABlasterPlayerState::GetController() const { if (Character) { return Controller == nullptr ? Cast(Character->Controller) : Controller; } return nullptr; }