63 - Crouch Unequipped

This commit is contained in:
Kingsmedia 2022-05-04 14:57:48 +02:00
parent ab42efa036
commit b61d2d9ad0
5 changed files with 16 additions and 3 deletions

View File

@ -39,7 +39,7 @@ ABlasterCharacter::ABlasterCharacter()
GetCharacterMovement()->NavAgentProps.bCanCrouch = true;
GetCapsuleComponent()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Camera, ECollisionResponse::ECR_Ignore);
GetMesh()->SetCollisionResponseToChannel(ECollisionChannel::ECC_Camera, ECollisionResponse::ECR_Ignore);
GetCharacterMovement()->RotationRate = FRotator(0.f, 850.f, 0.f);
TurningInPlace = ETurningInPlace::ETIP_NotTurning;
NetUpdateFrequency = 66.f;
MinNetUpdateFrequency = 33.f;
@ -78,7 +78,7 @@ void ABlasterCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCo
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ABlasterCharacter::Jump);
PlayerInputComponent->BindAction("Equip", IE_Pressed, this, &ABlasterCharacter::EquipButtonPressed);
PlayerInputComponent->BindAction("Crouch", IE_Pressed, this, &ABlasterCharacter::CrouchButtonPressed);
PlayerInputComponent->BindAction("Aim", IE_Pressed, this, &ABlasterCharacter::AimButtonPressed);
@ -206,6 +206,18 @@ void ABlasterCharacter::AimOffset(float DeltaTime)
}
}
void ABlasterCharacter::Jump()
{
if (bIsCrouched)
{
UnCrouch();
}
else
{
Super::Jump();
}
}
void ABlasterCharacter::ServerEquipButtonPressed_Implementation()
{
EquipButtonPressed();

View File

@ -31,6 +31,7 @@ protected:
void AimButtonPressed();
void AimButtonReleased();
void AimOffset(float DeltaTime);
virtual void Jump() override;
private:
UPROPERTY(VisibleAnywhere, Category="Camera")

View File

@ -14,7 +14,7 @@ UCombatComponent::UCombatComponent()
PrimaryComponentTick.bCanEverTick = false;
BaseWalkSpeed = 600.f;
AimWalkSpeed = 450.f;
AimWalkSpeed = 350.f;
}
void UCombatComponent::BeginPlay()