Merge movement-component #1
Binary file not shown.
BIN
Content/Input/InputMappingContext.uasset (Stored with Git LFS)
BIN
Content/Input/InputMappingContext.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Player/PlayerCharacter.uasset (Stored with Git LFS)
BIN
Content/Player/PlayerCharacter.uasset (Stored with Git LFS)
Binary file not shown.
|
@ -188,6 +188,16 @@ void UNakatomiCMC::DisableCrouch()
|
||||||
bWantsToCrouch = false;
|
bWantsToCrouch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UNakatomiCMC::EnableSlide()
|
||||||
|
{
|
||||||
|
EnterSlide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void UNakatomiCMC::DisableSlide()
|
||||||
|
{
|
||||||
|
ExitSlide();
|
||||||
|
}
|
||||||
|
|
||||||
bool UNakatomiCMC::IsCustomMovementMode(ECustomMovementMove InCustomMovementMode) const
|
bool UNakatomiCMC::IsCustomMovementMode(ECustomMovementMove InCustomMovementMode) const
|
||||||
{
|
{
|
||||||
return MovementMode == MOVE_Custom && CustomMovementMode == InCustomMovementMode;
|
return MovementMode == MOVE_Custom && CustomMovementMode == InCustomMovementMode;
|
||||||
|
|
|
@ -106,6 +106,12 @@ public:
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void DisableCrouch();
|
void DisableCrouch();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void EnableSlide();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void DisableSlide();
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
bool IsCustomMovementMode(ECustomMovementMove InCustomMovementMode) const;
|
bool IsCustomMovementMode(ECustomMovementMove InCustomMovementMode) const;
|
||||||
|
|
||||||
|
|
|
@ -193,6 +193,12 @@ void APlayerCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCom
|
||||||
Input->BindAction(CrouchAction, ETriggerEvent::Started, this, &APlayerCharacter::BeginCrouchCallback);
|
Input->BindAction(CrouchAction, ETriggerEvent::Started, this, &APlayerCharacter::BeginCrouchCallback);
|
||||||
Input->BindAction(CrouchAction, ETriggerEvent::Completed, this, &APlayerCharacter::EndCrouchCallback);
|
Input->BindAction(CrouchAction, ETriggerEvent::Completed, this, &APlayerCharacter::EndCrouchCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SlideAction)
|
||||||
|
{
|
||||||
|
Input->BindAction(SlideAction, ETriggerEvent::Started, this, &APlayerCharacter::BeginSlideCallback);
|
||||||
|
Input->BindAction(SlideAction, ETriggerEvent::Completed, this, &APlayerCharacter::EndSlideCallback);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,6 +572,26 @@ void APlayerCharacter::EndCrouchCallback(const FInputActionInstance& Instance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void APlayerCharacter::BeginSlideCallback(const FInputActionInstance& Instance)
|
||||||
|
{
|
||||||
|
UNakatomiCMC* cmc = GetCharacterMovementComponent();
|
||||||
|
|
||||||
|
if (cmc)
|
||||||
|
{
|
||||||
|
cmc->EnableSlide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void APlayerCharacter::EndSlideCallback(const FInputActionInstance& Instance)
|
||||||
|
{
|
||||||
|
UNakatomiCMC* cmc = GetCharacterMovementComponent();
|
||||||
|
|
||||||
|
if (cmc)
|
||||||
|
{
|
||||||
|
cmc->DisableSlide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void APlayerCharacter::OnFire()
|
void APlayerCharacter::OnFire()
|
||||||
{
|
{
|
||||||
if (!IsFiring || CurrentWeapon->GetAmmoCount() == 0)
|
if (!IsFiring || CurrentWeapon->GetAmmoCount() == 0)
|
||||||
|
|
|
@ -67,6 +67,9 @@ public:
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
UInputAction* CrouchAction;
|
UInputAction* CrouchAction;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
|
UInputAction* SlideAction;
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
TSoftObjectPtr<UInputMappingContext> InputMappingContext;
|
TSoftObjectPtr<UInputMappingContext> InputMappingContext;
|
||||||
|
@ -181,6 +184,10 @@ public:
|
||||||
void BeginCrouchCallback(const FInputActionInstance& Instance);
|
void BeginCrouchCallback(const FInputActionInstance& Instance);
|
||||||
|
|
||||||
void EndCrouchCallback(const FInputActionInstance& Instance);
|
void EndCrouchCallback(const FInputActionInstance& Instance);
|
||||||
|
|
||||||
|
void BeginSlideCallback(const FInputActionInstance& Instance);
|
||||||
|
|
||||||
|
void EndSlideCallback(const FInputActionInstance& Instance);
|
||||||
|
|
||||||
virtual void OnFire() override;
|
virtual void OnFire() override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue