Added Sniper Weapon and started creating Base Functionality

This commit is contained in:
MARCEL HARA 2023-10-23 14:01:09 +01:00
parent 4c04c45d49
commit d12573f6cc
6 changed files with 95 additions and 3 deletions

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4d4a7e220c05cd641cf8f6465c767efb4bf895ca9ac7d473530dff9daeecac55
size 124137

View File

@ -10,6 +10,7 @@
#include "AI/EnemyCharacter.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "Kismet/GameplayStatics.h"
#include "GameFramework/MovementComponent.h"
//////////////////////////////////////////////////////////////////////////
@ -71,7 +72,17 @@ void AEndlessVendettaCharacter::Tick(float DeltaTime)
Super::Tick(DeltaTime);
WeaponPickUpSystem();
MoveGroundSpeed = Cast<UMovementComponent>(GetComponentByClass(UMovementComponent::StaticClass()))->Velocity.Size();
if (MoveGroundSpeed > 0)
{
bIsPlayerMoving = true;
}
else if (MoveGroundSpeed <= 0)
{
bIsPlayerMoving = false;
}
}
void AEndlessVendettaCharacter::WeaponPickUpSystem()

View File

@ -93,6 +93,10 @@ public:
int Money = 2000;
bool bIsReloading = false;
bool bIsPlayerMoving = false;
double MoveGroundSpeed;
/** Look Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* LookAction;

View File

@ -25,7 +25,7 @@ protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
void ApplyRecoil(float DeltaTime);
virtual void ApplyRecoil(float DeltaTime);
void GenerateRecoilVector();
@ -159,7 +159,7 @@ public:
//UFUNCTION(BlueprintCallable, Category = "Weapons")
//void RecoilVerticalLimit(FHitResult Outhit);
UPROPERTY(EditAnywhere)
UPROPERTY(VisibleAnywhere)
int bulletCountShoot; //Gets how many bullets shot per
void Interact() override;

View File

@ -0,0 +1,38 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "SniperClass.h"
#include "EndlessVendettaCharacter.h"
// Sets default values
ASniperClass::ASniperClass()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
}
// Called when the game starts or when spawned
void ASniperClass::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ASniperClass::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void ASniperClass::Fire()
{
}
void ASniperClass::ApplyRecoil(float DeltaTime)
{
if (endlessVendettaChar->bIsPlayerMoving)
{
UE_LOG(LogTemp, Display, TEXT("playerMovingIsTrue"));
}
}

View File

@ -0,0 +1,36 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "BaseWeaponClass.h"
#include "EndlessVendettaCharacter.h"
#include "SniperClass.generated.h"
/**
*
*/
UCLASS()
class ENDLESSVENDETTA_API ASniperClass : public ABaseWeaponClass
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ASniperClass();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
protected:
virtual void Fire() override;
virtual void ApplyRecoil(float DeltaTime) override;
};