140 - Sniper Scope

This commit is contained in:
Kingsmedia 2022-05-20 16:12:12 +02:00
parent 7a26940641
commit 977cdef60c
9 changed files with 13 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -137,6 +137,10 @@ void ABlasterCharacter::MulticastEliminated_Implementation()
GetActorLocation()
);
}
if (IsLocallyControlled() && GetEquippedWeapon()->GetWeaponType() == EWeaponType::EWT_SniperRifle && IsAiming())
{
ShowSniperScopeWidget(false);
}
}
void ABlasterCharacter::EliminationTimerFinished()

View File

@ -37,6 +37,9 @@ public:
UPROPERTY(Replicated)
bool bDisableGameplay = false;
UFUNCTION(BlueprintImplementableEvent)
void ShowSniperScopeWidget(bool bShowScope);
protected:
virtual void BeginPlay() override;

View File

@ -420,11 +420,15 @@ void UCombatComponent::InterpFOV(float DeltaTime)
void UCombatComponent::SetAiming(bool bIsAiming)
{
if (Character == nullptr || EquippedWeapon == nullptr) return;
bAiming = bIsAiming;
ServerSetAiming(bIsAiming);
if (Character)
Character->GetCharacterMovement()->MaxWalkSpeed = bIsAiming ? AimWalkSpeed : BaseWalkSpeed;
if (Character->IsLocallyControlled() && EquippedWeapon->GetWeaponType() == EWeaponType::EWT_SniperRifle)
{
Character->GetCharacterMovement()->MaxWalkSpeed = bIsAiming ? AimWalkSpeed : BaseWalkSpeed;
Character->ShowSniperScopeWidget(bIsAiming);
}
}