48 - Crouching
This commit is contained in:
parent
12252d7ae6
commit
add3b474be
|
@ -76,6 +76,7 @@ FOVScale=0.011110
|
||||||
DoubleClickTime=0.200000
|
DoubleClickTime=0.200000
|
||||||
+ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar)
|
+ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar)
|
||||||
+ActionMappings=(ActionName="Equip",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=E)
|
+ActionMappings=(ActionName="Equip",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=E)
|
||||||
|
+ActionMappings=(ActionName="Crouch",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftControl)
|
||||||
+AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=W)
|
+AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=W)
|
||||||
+AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=S)
|
+AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=S)
|
||||||
+AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=D)
|
+AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=D)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -31,4 +31,5 @@ void UBlasterAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
|
||||||
bIsInAir = BlasterCharacter->GetCharacterMovement()->IsFalling();
|
bIsInAir = BlasterCharacter->GetCharacterMovement()->IsFalling();
|
||||||
bIsAccelerating = BlasterCharacter->GetCharacterMovement()->GetCurrentAcceleration().Size() > 0.f;
|
bIsAccelerating = BlasterCharacter->GetCharacterMovement()->GetCurrentAcceleration().Size() > 0.f;
|
||||||
bWeaponEquipped = BlasterCharacter->IsWeaponEquipped();
|
bWeaponEquipped = BlasterCharacter->IsWeaponEquipped();
|
||||||
|
bIsCrouched = BlasterCharacter->bIsCrouched;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,4 +35,7 @@ private:
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadOnly, Category="Movement", meta=(AllowPrivateAccess = "true"))
|
UPROPERTY(BlueprintReadOnly, Category="Movement", meta=(AllowPrivateAccess = "true"))
|
||||||
bool bWeaponEquipped;
|
bool bWeaponEquipped;
|
||||||
|
|
||||||
|
UPROPERTY(BlueprintReadOnly, Category="Movement", meta=(AllowPrivateAccess = "true"))
|
||||||
|
bool bIsCrouched;
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,6 +33,8 @@ ABlasterCharacter::ABlasterCharacter()
|
||||||
|
|
||||||
Combat = CreateDefaultSubobject<UCombatComponent>(TEXT("CombatComponent"));
|
Combat = CreateDefaultSubobject<UCombatComponent>(TEXT("CombatComponent"));
|
||||||
Combat->SetIsReplicated(true);
|
Combat->SetIsReplicated(true);
|
||||||
|
|
||||||
|
GetCharacterMovement()->NavAgentProps.bCanCrouch = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABlasterCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
|
void ABlasterCharacter::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
|
||||||
|
@ -68,6 +70,7 @@ void ABlasterCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCo
|
||||||
|
|
||||||
PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
|
PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
|
||||||
PlayerInputComponent->BindAction("Equip", IE_Pressed, this, &ABlasterCharacter::EquipButtonPressed);
|
PlayerInputComponent->BindAction("Equip", IE_Pressed, this, &ABlasterCharacter::EquipButtonPressed);
|
||||||
|
PlayerInputComponent->BindAction("Crouch", IE_Pressed, this, &ABlasterCharacter::CrouchButtonPressed);
|
||||||
|
|
||||||
PlayerInputComponent->BindAxis("MoveForward", this, &ABlasterCharacter::MoveForward);
|
PlayerInputComponent->BindAxis("MoveForward", this, &ABlasterCharacter::MoveForward);
|
||||||
PlayerInputComponent->BindAxis("MoveRight", this, &ABlasterCharacter::MoveRight);
|
PlayerInputComponent->BindAxis("MoveRight", this, &ABlasterCharacter::MoveRight);
|
||||||
|
@ -122,6 +125,18 @@ void ABlasterCharacter::EquipButtonPressed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ABlasterCharacter::CrouchButtonPressed()
|
||||||
|
{
|
||||||
|
if (bIsCrouched)
|
||||||
|
{
|
||||||
|
UnCrouch();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Crouch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ABlasterCharacter::ServerEquipButtonPressed_Implementation()
|
void ABlasterCharacter::ServerEquipButtonPressed_Implementation()
|
||||||
{
|
{
|
||||||
EquipButtonPressed();
|
EquipButtonPressed();
|
||||||
|
|
|
@ -26,6 +26,7 @@ protected:
|
||||||
void Turn(float Value);
|
void Turn(float Value);
|
||||||
void LookUp(float Value);
|
void LookUp(float Value);
|
||||||
void EquipButtonPressed();
|
void EquipButtonPressed();
|
||||||
|
void CrouchButtonPressed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UPROPERTY(VisibleAnywhere, Category="Camera")
|
UPROPERTY(VisibleAnywhere, Category="Camera")
|
||||||
|
|
Loading…
Reference in New Issue