diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index 99117de..782d8e1 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -1,8 +1,8 @@ [/Script/EngineSettings.GameMapsSettings] -GameDefaultMap=/Game/Maps/GameStartupMap.GameStartupMap -EditorStartupMap=/Game/Maps/GameStartupMap.GameStartupMap +GameDefaultMap=/Game/Maps/MainStageMap.MainStageMap +EditorStartupMap=/Game/Maps/MainStageMap.MainStageMap TransitionMap=/Game/Maps/TransitionMap.TransitionMap [/Script/WindowsTargetPlatform.WindowsTargetSettings] diff --git a/Content/D2Contents/Blueprints/BP_D2BaseCharacter.uasset b/Content/D2Contents/Blueprints/BP_D2BaseCharacter.uasset index 53fb795..c80567d 100644 Binary files a/Content/D2Contents/Blueprints/BP_D2BaseCharacter.uasset and b/Content/D2Contents/Blueprints/BP_D2BaseCharacter.uasset differ diff --git a/Content/D2Contents/Blueprints/HUD/WBP_OverheadWidget.uasset b/Content/D2Contents/Blueprints/HUD/WBP_OverheadWidget.uasset index 17134dc..1e38e38 100644 Binary files a/Content/D2Contents/Blueprints/HUD/WBP_OverheadWidget.uasset and b/Content/D2Contents/Blueprints/HUD/WBP_OverheadWidget.uasset differ diff --git a/Content/D2Contents/Blueprints/HUD/WBP_PickupWidget.uasset b/Content/D2Contents/Blueprints/HUD/WBP_PickupWidget.uasset new file mode 100644 index 0000000..591b7b2 Binary files /dev/null and b/Content/D2Contents/Blueprints/HUD/WBP_PickupWidget.uasset differ diff --git a/Content/D2Contents/Blueprints/Weapon/BP_Weapon.uasset b/Content/D2Contents/Blueprints/Weapon/BP_Weapon.uasset index 8b845ed..1ea695f 100644 Binary files a/Content/D2Contents/Blueprints/Weapon/BP_Weapon.uasset and b/Content/D2Contents/Blueprints/Weapon/BP_Weapon.uasset differ diff --git a/Content/Maps/MainStageMap.umap b/Content/Maps/MainStageMap.umap index 496f84e..e8c9b20 100644 Binary files a/Content/Maps/MainStageMap.umap and b/Content/Maps/MainStageMap.umap differ diff --git a/Source/D2/Character/D2BaseCharacter.h b/Source/D2/Character/D2BaseCharacter.h index d62ef54..0f99f84 100644 --- a/Source/D2/Character/D2BaseCharacter.h +++ b/Source/D2/Character/D2BaseCharacter.h @@ -18,7 +18,7 @@ public: protected: virtual void BeginPlay() override; - + public: virtual void Tick(float DeltaTime) override; virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; diff --git a/Source/D2/Weapon/Weapon.cpp b/Source/D2/Weapon/Weapon.cpp index c29f763..e4881c8 100644 --- a/Source/D2/Weapon/Weapon.cpp +++ b/Source/D2/Weapon/Weapon.cpp @@ -3,7 +3,9 @@ #include "Weapon/Weapon.h" +#include "Character/D2BaseCharacter.h" #include "Components/SphereComponent.h" +#include "Components/WidgetComponent.h" AWeapon::AWeapon() { @@ -23,16 +25,30 @@ AWeapon::AWeapon() AreaSphere->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore); AreaSphere->SetCollisionEnabled(ECollisionEnabled::NoCollision); - if(HasAuthority()) - { - AreaSphere->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics); - AreaSphere->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Overlap); - } + PickupWidget = CreateDefaultSubobject(TEXT("PickupWidget")); + PickupWidget->SetupAttachment(RootComponent); } void AWeapon::BeginPlay() { Super::BeginPlay(); + + if(HasAuthority()) + { + AreaSphere->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics); + AreaSphere->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Overlap); + AreaSphere->OnComponentBeginOverlap.AddDynamic(this, &AWeapon::OnSphereOverlap); + } + + if(PickupWidget) + PickupWidget->SetVisibility(false); +} + +void AWeapon::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) +{ + AD2BaseCharacter* BaseCharacter = Cast(OtherActor); + if(BaseCharacter && PickupWidget) + PickupWidget->SetVisibility(true); } void AWeapon::Tick(float DeltaTime) diff --git a/Source/D2/Weapon/Weapon.h b/Source/D2/Weapon/Weapon.h index 7028f1f..40672e8 100644 --- a/Source/D2/Weapon/Weapon.h +++ b/Source/D2/Weapon/Weapon.h @@ -26,7 +26,9 @@ public: protected: virtual void BeginPlay() override; - + UFUNCTION() + virtual void OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult); + public: virtual void Tick(float DeltaTime) override; @@ -37,6 +39,9 @@ private: UPROPERTY(VisibleAnywhere, Category = "Weapon Properties") TObjectPtr AreaSphere; - UPROPERTY(VisibleAnywhere) + UPROPERTY(VisibleAnywhere, Category = "Weapon Properties") EWeaponState WeaponState; + + UPROPERTY(VisibleAnywhere, Category = "Weapon Properties") + TObjectPtr PickupWidget; };