diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset index 690d04ef..0877150a 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d5de8f4e27f1e085417782dd7729fc662c3ab813afabba992a0bfe6ad51573c -size 35545 +oid sha256:92f8bdd8d4e8196894411a8141429f15316d83e076b0163070ee174bd3eb4ac7 +size 32087 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset new file mode 100644 index 00000000..50209cd2 --- /dev/null +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b311799aa263b7af6d3eb738da33d39b0d40d7883bf0a4e3cb6024e06157cec +size 37724 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset index 16d0e458..fe34a700 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/Pistols/BP_BasePistolWeapon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f562f592d0a4fc6f34c7deb5c861593a1b7282f786b19b3789fbac2bee01c7a1 -size 29063 +oid sha256:60c71c86a00bef84374641ca7fed67e2338916dba788e69d643a8477add71d97 +size 29026 diff --git a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_EquipPrimaryWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_EquipPrimaryWeapon.uasset new file mode 100644 index 00000000..62f17b30 --- /dev/null +++ b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_EquipPrimaryWeapon.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8920145a0a5f7ac0f10a98d15f35f28926503ff5d3ea093c79a07688b92bfdf +size 1707 diff --git a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_EquipSecondaryWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_EquipSecondaryWeapon.uasset new file mode 100644 index 00000000..3c045634 --- /dev/null +++ b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_EquipSecondaryWeapon.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8f05f0bf87ed32cb40eac24d420dc279e2e808df4358300d3f3b839530267584 +size 1717 diff --git a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_WeaponEquip.uasset b/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_WeaponEquip.uasset deleted file mode 100644 index d06772c3..00000000 --- a/EndlessVendetta/Content/FirstPerson/Input/Actions/IA_WeaponEquip.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d0c07e01e5199aaa3d4e7fb5dc36733918e91aa93620cbef070e2472021315d4 -size 1672 diff --git a/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset b/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset index 4568b732..c85553cd 100644 --- a/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset +++ b/EndlessVendetta/Content/FirstPerson/Input/IMC_Default.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7d38ac187045f18e01436a5d90333878b3490d25037c84c712f943cb34f785bb -size 14484 +oid sha256:ffa41b9939bbfe39ea2480464028578938aa1a8c0acc1edeac030ade6d1d9d76 +size 14001 diff --git a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/1/1E/W6O6OMVMAU1GMH2HVWXH3L.uasset b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/1/1E/W6O6OMVMAU1GMH2HVWXH3L.uasset index 9414b284..fa367335 100644 --- a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/1/1E/W6O6OMVMAU1GMH2HVWXH3L.uasset +++ b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/1/1E/W6O6OMVMAU1GMH2HVWXH3L.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:df93071fd48bde5bf300bdb99470e05451e488b38627fbf6b22212b3c03e0fd3 +oid sha256:abfeb59ea7bea538e1b873a97345a0336c40b7c353d167ddd1a4fac4a16dcad6 size 5061 diff --git a/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/7/GA/SIX97XFU4YK3BWI9S71SMF.uasset b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/7/GA/SIX97XFU4YK3BWI9S71SMF.uasset new file mode 100644 index 00000000..bd2505f8 --- /dev/null +++ b/EndlessVendetta/Content/__ExternalActors__/FirstPerson/Maps/GunMechanicTester/7/GA/SIX97XFU4YK3BWI9S71SMF.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c7be8ced7b103ba47409aefeea3621d8602fcd366160651c53447a7c2f866e4 +size 5097 diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp index f9dc4927..ef3f3c8e 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp @@ -71,7 +71,53 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent* EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Look); //Weapon Switching - EnhancedInputComponent->BindAction(WeaponEquipAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::WeaponEquip); + EnhancedInputComponent->BindAction(EquipPrimaryWeapon, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::EquipPrimary); + EnhancedInputComponent->BindAction(EquipSecondaryWeapon, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::EquipSecondary); + } +} + +void AEndlessVendettaCharacter::EquipPrimary() +{ + UE_LOG(LogTemp, Display, TEXT("Primary equipped")); +} + +void AEndlessVendettaCharacter::EquipSecondary() +{ + UE_LOG(LogTemp, Display, TEXT("Secondary equipped")); +} + +//Called from Player BluePrints +void AEndlessVendettaCharacter::WeaponPickUpSystem(AActor* PickedUpWeapon) +{ + ABaseWeaponClass* WeaponInWorld = Cast(PickedUpWeapon); + if(WeaponInWorld->IsA(ABaseWeaponClass::StaticClass())) + { + if(PrimaryWeapon) + { + UE_LOG(LogTemp, Display, TEXT("Primary Weapon Picked up")); + bHasRifle = true; + FVector loc = GetActorLocation() + FVector(-50, 0, 0); + FRotator rot = GetActorRotation(); + FActorSpawnParameters spawnParams; + spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true); + //WeaponInWorld = Cast(GetWorld()->SpawnActor(PrimaryWeapon, loc, rot, spawnParams)); + WeaponInWorld->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); + WeaponInWorld->Destroy(); + + //for some reason the spawning of the weapon is broken to the players hand so need to fix this. + + // potentially add a varibable to check if its a secondary or priamry weapon being picked up + // add this in the baseweaponclass variable + } + } + if(WeaponInWorld->IsA(ABaseWeaponClass::StaticClass())) + { + if(SecondaryWeapon) + { + UE_LOG(LogTemp, Display, TEXT("Secondary Weapon Picked up")); + + } } } @@ -102,10 +148,6 @@ void AEndlessVendettaCharacter::Look(const FInputActionValue& Value) } } -void AEndlessVendettaCharacter::WeaponEquip() -{ - UE_LOG(LogTemp, Display, TEXT("EQUIPPING WEAPONS")); -} void AEndlessVendettaCharacter::SetHasRifle(bool bNewHasRifle) { diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h index c9405896..c96f307f 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.h @@ -3,6 +3,7 @@ #pragma once #include "CoreMinimal.h" +#include "BaseWeaponClass.h" #include "GameFramework/Character.h" #include "InputActionValue.h" #include "EndlessVendettaCharacter.generated.h" @@ -42,7 +43,10 @@ class AEndlessVendettaCharacter : public ACharacter /** Weapon Equip Action */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true")) - class UInputAction* WeaponEquipAction; + class UInputAction* EquipPrimaryWeapon; + + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true")) + class UInputAction* EquipSecondaryWeapon; public: @@ -69,15 +73,27 @@ public: UFUNCTION(BlueprintCallable, Category = Weapon) bool GetHasRifle(); + UPROPERTY(EditAnywhere, Category = "Weapons") + TSubclassOf PrimaryWeapon; + + UPROPERTY(EditAnywhere, Category = "Weapons") + TSubclassOf SecondaryWeapon; + protected: /** Called for movement input */ void Move(const FInputActionValue& Value); /** Called for looking input */ void Look(const FInputActionValue& Value); + + void EquipPrimary(); + + void EquipSecondary(); - void WeaponEquip(); - + //Called from Player BluePrints + UFUNCTION(BlueprintCallable, Category = "Weapons") + void WeaponPickUpSystem(AActor* PickedUpWeapon); + protected: // APawn interface virtual void SetupPlayerInputComponent(UInputComponent* InputComponent) override; @@ -88,10 +104,6 @@ public: USkeletalMeshComponent* GetMesh1P() const { return Mesh1P; } /** Returns FirstPersonCameraComponent subobject **/ UCameraComponent* GetFirstPersonCameraComponent() const { return FirstPersonCameraComponent; } - -private: - UWeaponInventory* WeaponInventory; - - + }; diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponInventory.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponInventory.cpp deleted file mode 100644 index 97262c6c..00000000 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponInventory.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - -#include "WeaponInventory.h" - -#include "WeaponItemClass.h" - - -// Sets default values for this component's properties -UWeaponInventory::UWeaponInventory() -{ - // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features - // off to improve performance if you don't need them. - PrimaryComponentTick.bCanEverTick = true; - -} - - -// Called when the game starts -void UWeaponInventory::BeginPlay() -{ - Super::BeginPlay(); - - // ... - -} - - -// Called every frame -void UWeaponInventory::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) -{ - Super::TickComponent(DeltaTime, TickType, ThisTickFunction); - - // ... -} - -//Called from blueprints from the player -void UWeaponInventory::WeaponPickup(AActor* WeaponPickedUp) -{ - AWeaponItemClass* WeaponItemClass = Cast(WeaponPickedUp); - WeaponsArray.Add(WeaponItemClass); - WeaponPickedUp->Destroy(); -} - diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponInventory.h b/EndlessVendetta/Source/EndlessVendetta/WeaponInventory.h deleted file mode 100644 index b060d0ac..00000000 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponInventory.h +++ /dev/null @@ -1,44 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#pragma once - -#include "CoreMinimal.h" -#include "Components/ActorComponent.h" -#include "WeaponInventory.generated.h" - - -class AWeaponItemClass; - -UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) -class ENDLESSVENDETTA_API UWeaponInventory : public UActorComponent -{ - GENERATED_BODY() - -public: - // Sets default values for this component's properties - UWeaponInventory(); - -protected: - // Called when the game starts - virtual void BeginPlay() override; - - UPROPERTY(VisibleAnywhere, Category = "Weapon System") - TArray WeaponsArray; - -public: - // Called every frame - virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; - - //Using a getter to get the protected weaponsArray - UFUNCTION() - TArray GetWeaponArray() const { return WeaponsArray; } - - //Using a Setter to set the protected weapons array to the getter - UFUNCTION() - void SetArray(const TArray weaponArray) { WeaponsArray = weaponArray; } - -private: - //Called from blueprints from the player - UFUNCTION(BlueprintCallable) - void WeaponPickup(AActor* WeaponPickedUp); -};