Updated PlayerCharacter to Crouch
This commit is contained in:
parent
8fc80f9b31
commit
8ef1ecf488
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Crouch.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/FirstPerson/Input/Actions/IA_Crouch.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/Ping/PingImage.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Gadgets/ReconGadgets/VisionLink/Ping/PingImage.uasset
(Stored with Git LFS)
Binary file not shown.
@ -6,6 +6,7 @@
|
|||||||
#include "Components/CapsuleComponent.h"
|
#include "Components/CapsuleComponent.h"
|
||||||
#include "EnhancedInputComponent.h"
|
#include "EnhancedInputComponent.h"
|
||||||
#include "EnhancedInputSubsystems.h"
|
#include "EnhancedInputSubsystems.h"
|
||||||
|
#include "GameFramework/CharacterMovementComponent.h"
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -16,6 +17,8 @@ AEndlessVendettaCharacter::AEndlessVendettaCharacter()
|
|||||||
// Character doesnt have a rifle at start
|
// Character doesnt have a rifle at start
|
||||||
bHasRifle = false;
|
bHasRifle = false;
|
||||||
|
|
||||||
|
//Enable Crouching
|
||||||
|
GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true;
|
||||||
// Set size for collision capsule
|
// Set size for collision capsule
|
||||||
GetCapsuleComponent()->InitCapsuleSize(55.f, 96.0f);
|
GetCapsuleComponent()->InitCapsuleSize(55.f, 96.0f);
|
||||||
|
|
||||||
@ -33,7 +36,6 @@ AEndlessVendettaCharacter::AEndlessVendettaCharacter()
|
|||||||
Mesh1P->CastShadow = false;
|
Mesh1P->CastShadow = false;
|
||||||
//Mesh1P->SetRelativeRotation(FRotator(0.9f, -19.19f, 5.2f));
|
//Mesh1P->SetRelativeRotation(FRotator(0.9f, -19.19f, 5.2f));
|
||||||
Mesh1P->SetRelativeLocation(FVector(-30.f, 0.f, -150.f));
|
Mesh1P->SetRelativeLocation(FVector(-30.f, 0.f, -150.f));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AEndlessVendettaCharacter::BeginPlay()
|
void AEndlessVendettaCharacter::BeginPlay()
|
||||||
@ -59,7 +61,6 @@ void AEndlessVendettaCharacter::BeginPlay()
|
|||||||
GadgetManager->SpawnGadgets(Cast<USceneComponent>(PlayersCamera));
|
GadgetManager->SpawnGadgets(Cast<USceneComponent>(PlayersCamera));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////// Input
|
//////////////////////////////////////////////////////////////////////////// Input
|
||||||
@ -89,9 +90,25 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent*
|
|||||||
|
|
||||||
//Weapon Shooting
|
//Weapon Shooting
|
||||||
EnhancedInputComponent->BindAction(TapShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::TapFireCaller);
|
EnhancedInputComponent->BindAction(TapShootAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::TapFireCaller);
|
||||||
|
|
||||||
|
//Crouching
|
||||||
|
EnhancedInputComponent->BindAction(CrouchAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::SetCrouch);
|
||||||
|
EnhancedInputComponent->BindAction(CrouchAction, ETriggerEvent::Completed, this, &AEndlessVendettaCharacter::SetUnCrouch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AEndlessVendettaCharacter::SetCrouch()
|
||||||
|
{
|
||||||
|
Crouch();
|
||||||
|
GLog->Log("Crouching");
|
||||||
|
}
|
||||||
|
|
||||||
|
void AEndlessVendettaCharacter::SetUnCrouch()
|
||||||
|
{
|
||||||
|
UnCrouch();
|
||||||
|
GLog->Log("UnCrouching");
|
||||||
|
}
|
||||||
|
|
||||||
void AEndlessVendettaCharacter::ToggleRecon()
|
void AEndlessVendettaCharacter::ToggleRecon()
|
||||||
{
|
{
|
||||||
if (IsValid(PrimaryWeapon)) EquipPrimary();
|
if (IsValid(PrimaryWeapon)) EquipPrimary();
|
||||||
@ -148,8 +165,8 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
|||||||
|
|
||||||
// Marcel I respect you, like you and what not, please for the love of god don't touch these two guard clauses
|
// Marcel I respect you, like you and what not, please for the love of god don't touch these two guard clauses
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return;/////////////////////////
|
if (GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return; /////////////////////////
|
||||||
if (GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return;///////////////////////
|
if (GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return; ///////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
FActorSpawnParameters spawnParams;
|
FActorSpawnParameters spawnParams;
|
||||||
@ -175,16 +192,16 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
|||||||
// if (IsValid(SecondaryWeapon)) EquipSecondary();
|
// if (IsValid(SecondaryWeapon)) EquipSecondary();
|
||||||
//
|
//
|
||||||
// UE_LOG(LogTemp, Display, TEXT("Primary equipped"));
|
// UE_LOG(LogTemp, Display, TEXT("Primary equipped"));
|
||||||
// bHasRifle = true;
|
// bHasRifle = true;
|
||||||
// FActorSpawnParameters spawnParams;
|
// FActorSpawnParameters spawnParams;
|
||||||
// spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
// spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
// FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true);
|
// FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true);
|
||||||
// //Creating a new actor object called PrimaryWeapon that is based off primaryweaponClass
|
// //Creating a new actor object called PrimaryWeapon that is based off primaryweaponClass
|
||||||
// AActor* PrimaryWeaponActor = GetWorld()->SpawnActor<AActor>(PrimaryWeaponClass, spawnParams);
|
// AActor* PrimaryWeaponActor = GetWorld()->SpawnActor<AActor>(PrimaryWeaponClass, spawnParams);
|
||||||
// PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
// PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
||||||
// //Changing PrimaryWeaponActor to ABaseWeaponClass type instead of actor and storing it into PrimaryWeapon which is a ABaseClass Object
|
// //Changing PrimaryWeaponActor to ABaseWeaponClass type instead of actor and storing it into PrimaryWeapon which is a ABaseClass Object
|
||||||
// //We do this because we need to check if PrimaryWeapon is equipped and we want primaryweapon to be ABaseWeapon type and not a generic AActor
|
// //We do this because we need to check if PrimaryWeapon is equipped and we want primaryweapon to be ABaseWeapon type and not a generic AActor
|
||||||
// PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
// PrimaryWeapon = Cast<ABaseWeaponClass>(PrimaryWeaponActor);
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
// else if (IsValid(PrimaryWeapon))
|
// else if (IsValid(PrimaryWeapon))
|
||||||
@ -197,19 +214,19 @@ void AEndlessVendettaCharacter::EquipPrimary()
|
|||||||
void AEndlessVendettaCharacter::EquipSecondary()
|
void AEndlessVendettaCharacter::EquipSecondary()
|
||||||
{
|
{
|
||||||
if (IsValid(SecondaryWeapon))
|
if (IsValid(SecondaryWeapon))
|
||||||
{
|
{
|
||||||
SecondaryWeapon->Destroy();
|
SecondaryWeapon->Destroy();
|
||||||
SecondaryWeapon = nullptr;
|
SecondaryWeapon = nullptr;
|
||||||
bHasRifle = false;
|
bHasRifle = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsValid(PrimaryWeapon)) EquipPrimary();
|
if (IsValid(PrimaryWeapon)) EquipPrimary();
|
||||||
|
|
||||||
// Marcel I respect you, like you and what not, please for the love of god don't touch these two guard clauses
|
// Marcel I respect you, like you and what not, please for the love of god don't touch these two guard clauses
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
if (GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return;/////////////////////////
|
if (GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return; /////////////////////////
|
||||||
if (GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return;///////////////////////
|
if (GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return; ///////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
FActorSpawnParameters spawnParams;
|
FActorSpawnParameters spawnParams;
|
||||||
@ -226,20 +243,19 @@ void AEndlessVendettaCharacter::EquipSecondary()
|
|||||||
// if (IsValid(PrimaryWeapon)) EquipPrimary();
|
// if (IsValid(PrimaryWeapon)) EquipPrimary();
|
||||||
//
|
//
|
||||||
// UE_LOG(LogTemp, Display, TEXT("Secondary equipped"));
|
// UE_LOG(LogTemp, Display, TEXT("Secondary equipped"));
|
||||||
// bHasRifle = true;
|
// bHasRifle = true;
|
||||||
// FActorSpawnParameters spawnParams;
|
// FActorSpawnParameters spawnParams;
|
||||||
// spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
// spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
// FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true);
|
// FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true);
|
||||||
// AActor* SecondaryWeaponActor = GetWorld()->SpawnActor<AActor>(SecondaryWeaponClass, spawnParams);
|
// AActor* SecondaryWeaponActor = GetWorld()->SpawnActor<AActor>(SecondaryWeaponClass, spawnParams);
|
||||||
// SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
// SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint"));
|
||||||
// SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
// SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
|
||||||
// }
|
// }
|
||||||
// else if (IsValid(SecondaryWeapon))
|
// else if (IsValid(SecondaryWeapon))
|
||||||
// {
|
// {
|
||||||
// SecondaryWeapon->Destroy();
|
// SecondaryWeapon->Destroy();
|
||||||
// bHasRifle = false;
|
// bHasRifle = false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Calls the fire function in the baseWeaponClass
|
//Calls the fire function in the baseWeaponClass
|
||||||
|
@ -33,15 +33,15 @@ class AEndlessVendettaCharacter : public ACharacter
|
|||||||
|
|
||||||
/** MappingContext */
|
/** MappingContext */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
||||||
class UInputMappingContext* DefaultMappingContext;
|
UInputMappingContext* DefaultMappingContext;
|
||||||
|
|
||||||
/** Jump Input Action */
|
/** Jump Input Action */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
||||||
class UInputAction* JumpAction;
|
UInputAction* JumpAction;
|
||||||
|
|
||||||
/** Move Input Action */
|
/** Move Input Action */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
||||||
class UInputAction* MoveAction;
|
UInputAction* MoveAction;
|
||||||
|
|
||||||
// Gadget Actions
|
// Gadget Actions
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
||||||
@ -51,16 +51,19 @@ class AEndlessVendettaCharacter : public ACharacter
|
|||||||
|
|
||||||
/** Weapon Equip Action */
|
/** Weapon Equip Action */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
||||||
class UInputAction* EquipPrimaryWeapon;
|
UInputAction* EquipPrimaryWeapon;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
||||||
class UInputAction* EquipSecondaryWeapon;
|
UInputAction* EquipSecondaryWeapon;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
||||||
class UInputAction* TapShootAction;
|
UInputAction* TapShootAction;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
||||||
class UInputAction* HoldShootAction;
|
UInputAction* HoldShootAction;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = ( AllowPrivateAccess = "true" ))
|
||||||
|
UInputAction* CrouchAction;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AEndlessVendettaCharacter();
|
AEndlessVendettaCharacter();
|
||||||
@ -73,7 +76,6 @@ protected:
|
|||||||
AGadgetManager* GadgetManager;
|
AGadgetManager* GadgetManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Look Input Action */
|
/** Look Input Action */
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||||
class UInputAction* LookAction;
|
class UInputAction* LookAction;
|
||||||
@ -103,7 +105,6 @@ public:
|
|||||||
UFUNCTION(BlueprintCallable, Category = "Weapons")
|
UFUNCTION(BlueprintCallable, Category = "Weapons")
|
||||||
void TapFireCaller();
|
void TapFireCaller();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Called for movement input */
|
/** Called for movement input */
|
||||||
void Move(const FInputActionValue& Value);
|
void Move(const FInputActionValue& Value);
|
||||||
@ -123,16 +124,18 @@ protected:
|
|||||||
//UFUNCTION(BlueprintCallable, Category = "Weapons")
|
//UFUNCTION(BlueprintCallable, Category = "Weapons")
|
||||||
//void WeaponPickUpSystem(AActor* PickedUpWeapon);
|
//void WeaponPickUpSystem(AActor* PickedUpWeapon);
|
||||||
|
|
||||||
protected:
|
|
||||||
// APawn interface
|
// APawn interface
|
||||||
virtual void SetupPlayerInputComponent(UInputComponent* InputComponent) override;
|
virtual void SetupPlayerInputComponent(UInputComponent* InputComponent) override;
|
||||||
// End of APawn interface
|
// End of APawn interface
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Stealth")
|
||||||
|
void SetCrouch();
|
||||||
|
UFUNCTION(BlueprintCallable, Category = "Stealth")
|
||||||
|
void SetUnCrouch();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Returns Mesh1P subobject **/
|
/** Returns Mesh1P Sub-object **/
|
||||||
USkeletalMeshComponent* GetMesh1P() const { return Mesh1P; }
|
USkeletalMeshComponent* GetMesh1P() const { return Mesh1P; }
|
||||||
/** Returns FirstPersonCameraComponent subobject **/
|
/** Returns FirstPersonCameraComponent Sub-object **/
|
||||||
UCameraComponent* GetFirstPersonCameraComponent() const { return FirstPersonCameraComponent; }
|
UCameraComponent* GetFirstPersonCameraComponent() const { return FirstPersonCameraComponent; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user