diff --git a/EndlessVendetta/Content/Gadgets/TestGadgets/RC_ExampleRecon.uasset b/EndlessVendetta/Content/Gadgets/TestGadgets/RC_ExampleRecon.uasset index 484c5c92..7630574b 100644 --- a/EndlessVendetta/Content/Gadgets/TestGadgets/RC_ExampleRecon.uasset +++ b/EndlessVendetta/Content/Gadgets/TestGadgets/RC_ExampleRecon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c4186b567ed68cae389b7f52baee361aec478d019d5b727ecc6132b12c8d02b -size 29907 +oid sha256:0d162dc461b9db3b93d49bf5d7abe2a0b1a96faba906ab9faef43bb9fed45ca5 +size 29969 diff --git a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset index 8a892c7b..c2a34afc 100644 --- a/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset +++ b/EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4bad1f067f8be7d35d0fdde8fb883c0f0ec45cedecadc67f58f2f0d9b4e484fb -size 14831 +oid sha256:4c0ecf0ac0702cc2bd355ec050232a61c49e10f102448efbeb735a51824adef6 +size 14948 diff --git a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset index bf2e4391..16ecae3d 100644 --- a/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset +++ b/EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01ef616c7a8bd90cd1b7a13efb18a56f33346efbae51efa31f09804478b7621d -size 43456 +oid sha256:64419a367bb9a6ffc554aad1ea3a6c988438aa4ff5d6f712c1702664d5fb9e0f +size 53268 diff --git a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp index 1f197632..b54d9bab 100644 --- a/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/EndlessVendettaCharacter.cpp @@ -131,76 +131,120 @@ void AEndlessVendettaCharacter::ToggleCombat() //When 1 is pressed it calls EquipPrimary void AEndlessVendettaCharacter::EquipPrimary() { + if (IsValid(PrimaryWeapon)) + { + PrimaryWeapon->Destroy(); + PrimaryWeapon = nullptr; + bHasRifle = false; + return; + } + + if (IsValid(SecondaryWeapon)) EquipSecondary(); + // 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->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return;/////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////// + + FActorSpawnParameters spawnParams; + spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true); + + bHasRifle = true; + //Creating a new actor object called PrimaryWeapon that is based off primaryweaponClass + AActor* PrimaryWeaponActor = GetWorld()->SpawnActor(PrimaryWeaponClass, spawnParams); + PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); + //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 + PrimaryWeapon = Cast(PrimaryWeaponActor); //If primary weapon is not there but secondary weapon is it will call equipSecondary. //EquipSecondary checks and sees that secondary is there so it will call to destroy itself //Code goes back and sees primary weapon is not there anymore and spawns it in. //Same thing for the EquipSecondary() - if (!IsValid(PrimaryWeapon)) - { - if (IsValid(SecondaryWeapon)) EquipSecondary(); - UE_LOG(LogTemp, Display, TEXT("Primary equipped")); - bHasRifle = true; - FActorSpawnParameters spawnParams; - spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; - FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true); - //Creating a new actor object called PrimaryWeapon that is based off primaryweaponClass - AActor* PrimaryWeaponActor = GetWorld()->SpawnActor(PrimaryWeaponClass, spawnParams); - PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); - //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 - PrimaryWeapon = Cast(PrimaryWeaponActor); - - } - else if (IsValid(PrimaryWeapon)) - { - PrimaryWeapon->Destroy(); - bHasRifle = false; - - } + + // if (!IsValid(PrimaryWeapon)) + // { + // if (IsValid(SecondaryWeapon)) EquipSecondary(); + // + // UE_LOG(LogTemp, Display, TEXT("Primary equipped")); + // bHasRifle = true; + // FActorSpawnParameters spawnParams; + // spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + // FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true); + // //Creating a new actor object called PrimaryWeapon that is based off primaryweaponClass + // AActor* PrimaryWeaponActor = GetWorld()->SpawnActor(PrimaryWeaponClass, spawnParams); + // PrimaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); + // //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 + // PrimaryWeapon = Cast(PrimaryWeaponActor); + // + // } + // else if (IsValid(PrimaryWeapon)) + // { + // PrimaryWeapon->Destroy(); + // bHasRifle = false; + // } } void AEndlessVendettaCharacter::EquipSecondary() { + if (IsValid(SecondaryWeapon)) + { + SecondaryWeapon->Destroy(); + SecondaryWeapon = nullptr; + bHasRifle = false; + return; + } + + 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 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// if (GadgetManager->IsReconEquipped() && !GadgetManager->TryToUnequipRecon()) return;///////////////////////// if (GadgetManager->IsCombatEquipped() && !GadgetManager->TryToUnequipCombat()) return;/////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////// - - if (!IsValid(SecondaryWeapon)) - { - if (IsValid(PrimaryWeapon)) EquipPrimary(); - UE_LOG(LogTemp, Display, TEXT("Secondary equipped")); - bHasRifle = true; - FActorSpawnParameters spawnParams; - spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; - FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true); - AActor* SecondaryWeaponActor = GetWorld()->SpawnActor(SecondaryWeaponClass, spawnParams); - SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); - SecondaryWeapon = Cast(SecondaryWeaponActor); - } - else if (IsValid(SecondaryWeapon)) - { - SecondaryWeapon->Destroy(); - bHasRifle = false; - } + FActorSpawnParameters spawnParams; + spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true); + + bHasRifle = true; + AActor* SecondaryWeaponActor = GetWorld()->SpawnActor(SecondaryWeaponClass, spawnParams); + SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); + SecondaryWeapon = Cast(SecondaryWeaponActor); + + // if (!IsValid(SecondaryWeapon)) + // { + // if (IsValid(PrimaryWeapon)) EquipPrimary(); + // + // UE_LOG(LogTemp, Display, TEXT("Secondary equipped")); + // bHasRifle = true; + // FActorSpawnParameters spawnParams; + // spawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + // FAttachmentTransformRules AttachmentRules(EAttachmentRule::SnapToTarget, true); + // AActor* SecondaryWeaponActor = GetWorld()->SpawnActor(SecondaryWeaponClass, spawnParams); + // SecondaryWeaponActor->AttachToComponent(Mesh1P, AttachmentRules, FName("GripPoint")); + // SecondaryWeapon = Cast(SecondaryWeaponActor); + // } + // else if (IsValid(SecondaryWeapon)) + // { + // SecondaryWeapon->Destroy(); + // bHasRifle = false; + // } + } //Calls the fire function in the baseWeaponClass void AEndlessVendettaCharacter::TapFireCaller() { - if (IsValid(PrimaryWeapon) || IsValid(SecondaryWeapon)) - { - PrimaryWeaponClass.GetDefaultObject()->TapFire(); - } + UE_LOG(LogTemp, Warning, TEXT("Tap Fire")); + // if (IsValid(PrimaryWeapon) || IsValid(SecondaryWeapon)) + // { + // PrimaryWeaponClass.GetDefaultObject()->TapFire(); + // } } //POTENTIAL PICKUP SYSTEM NEEDS CHANGING BUT YES diff --git a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetManager.h b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetManager.h index 837c1222..7935ac0d 100644 --- a/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetManager.h +++ b/EndlessVendetta/Source/EndlessVendetta/GadgetSystem/GadgetManager.h @@ -56,19 +56,13 @@ public: bool TryToUnequipRecon() { - if (ReconGadget->Equipped) - { - return ReconGadget->Unequip(); - } + if (ReconGadget->Equipped) return ReconGadget->Unequip(); return false; } bool TryToUnequipCombat() { - if (CombatGadget->Equipped) - { - return CombatGadget->Unequip(); - } + if (CombatGadget->Equipped) return CombatGadget->Unequip(); return false; }