Added New AR Test & Started working on switching system

This commit is contained in:
MH261677 2023-10-19 16:44:35 +01:00
parent feeb0f36d6
commit 6c1c5ca12e
7 changed files with 41 additions and 10 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:fb7eb23a18c0ad9f5cf37ae72d45bac1d1b1d90fac9281cfa3e3233b9b6a3d44 oid sha256:dfeced37123c7e12907f8c5c3882aa970013d96167d07df1d71a464e2f91fd0d
size 42950 size 42429

View File

@ -84,7 +84,6 @@ void AEndlessVendettaCharacter::WeaponPickUpSystem()
if (!GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_Camera, QueryParams)) return; if (!GetWorld()->LineTraceSingleByChannel(OutHit, LT_Start, LT_End, ECC_Camera, QueryParams)) return;
AActor* HitActor = OutHit.GetActor(); AActor* HitActor = OutHit.GetActor();
UE_LOG(LogTemp, Warning, TEXT("Hit actor: %s"), *HitActor->GetName());
IInteractionInterface* InteractableActor = Cast<IInteractionInterface>(HitActor); IInteractionInterface* InteractableActor = Cast<IInteractionInterface>(HitActor);
if (InteractableActor) InteractableActor->InteractPrompt(); if (InteractableActor) InteractableActor->InteractPrompt();
} }
@ -144,7 +143,11 @@ void AEndlessVendettaCharacter::Interact()
AActor* HitActor = OutHit.GetActor(); AActor* HitActor = OutHit.GetActor();
UE_LOG(LogTemp, Warning, TEXT("Hit actor: %s"), *HitActor->GetName()); UE_LOG(LogTemp, Warning, TEXT("Hit actor: %s"), *HitActor->GetName());
IInteractionInterface* InteractableActor = Cast<IInteractionInterface>(HitActor); IInteractionInterface* InteractableActor = Cast<IInteractionInterface>(HitActor);
if (InteractableActor) InteractableActor->Interact(); if (InteractableActor)
{
InteractableActor->Interact();
WeaponSwitcher(OutHit);
}
} }
@ -271,6 +274,13 @@ void AEndlessVendettaCharacter::EquipSecondary()
SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor); SecondaryWeapon = Cast<ABaseWeaponClass>(SecondaryWeaponActor);
} }
void AEndlessVendettaCharacter::WeaponSwitcher(FHitResult Outhit)
{
if (IsValid(PrimaryWeapon)) PrimaryWeapon->Destroy();
PrimaryWeapon = Cast<ABaseWeaponClass>(Outhit.GetActor());
Outhit.GetActor()->Destroy();
}
//Calls the fire function in the baseWeaponClass //Calls the fire function in the baseWeaponClass
void AEndlessVendettaCharacter::FireCaller() void AEndlessVendettaCharacter::FireCaller()
{ {

View File

@ -148,9 +148,6 @@ protected:
void ToggleRecon(); void ToggleRecon();
void ToggleCombat(); void ToggleCombat();
void EquipPrimary();
void EquipSecondary();
UPROPERTY(EditDefaultsOnly, Category = "Interaction") UPROPERTY(EditDefaultsOnly, Category = "Interaction")
float InteractionRange = 250; float InteractionRange = 250;
void Interact(); void Interact();
@ -175,4 +172,9 @@ public:
virtual float TakeDamage(float DamageAmount, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser) override; virtual float TakeDamage(float DamageAmount, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser) override;
void WeaponPickUpSystem(); void WeaponPickUpSystem();
void EquipPrimary();
void EquipSecondary();
void WeaponSwitcher(FHitResult Outhit);
}; };

View File

@ -232,15 +232,29 @@ void ABaseWeaponClass::WeaponReload()
void ABaseWeaponClass::Interact() void ABaseWeaponClass::Interact()
{ {
if(!IsValid(this)) return;
GLog->Log("Interact Called"); GLog->Log("Interact Called");
} }
void ABaseWeaponClass::InteractPrompt() void ABaseWeaponClass::InteractPrompt()
{ {
WeaponStatsPopUp(); WeaponStatsPopUp();
UE_LOG(LogTemp, Warning, TEXT("InteractPrompt setup"))
} }
// void ABaseWeaponClass::GetOutHit(FHitResult OutHit)
// {
// if(IsValid(this))
// {
// endlessVendettaChar->PrimaryWeapon->Destroy();
// }
// if (OutHit.GetActor()->ActorHasTag(FName("AssaultRifle")))
// {
// endlessVendettaChar->EquipPrimary();
// }
// //HitActor = Cast<ABaseWeaponClass>(endlessVendettaChar->PrimaryWeaponClass);
// //endlessVendettaChar->PrimaryWeapon = Cast<ABaseWeaponClass>(HitActor);
// }

View File

@ -168,6 +168,8 @@ public:
UFUNCTION(BlueprintImplementableEvent) UFUNCTION(BlueprintImplementableEvent)
void WeaponStatsPopUp(); void WeaponStatsPopUp();
//void GetOutHit(FHitResult OutHit);
protected: protected:
UArrowComponent* GunStartArrow; UArrowComponent* GunStartArrow;
bool bStopShooting = false; bool bStopShooting = false;