[박치영] 추가작업
parent
3e70ac69c0
commit
205538211f
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
[/Script/EngineSettings.GameMapsSettings]
|
[/Script/EngineSettings.GameMapsSettings]
|
||||||
GameDefaultMap=/Game/Maps/GameStartupMap.GameStartupMap
|
GameDefaultMap=/Game/Maps/MainStageMap.MainStageMap
|
||||||
EditorStartupMap=/Game/Maps/GameStartupMap.GameStartupMap
|
EditorStartupMap=/Game/Maps/MainStageMap.MainStageMap
|
||||||
TransitionMap=/Game/Maps/TransitionMap.TransitionMap
|
TransitionMap=/Game/Maps/TransitionMap.TransitionMap
|
||||||
|
|
||||||
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
|
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -18,7 +18,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void Tick(float DeltaTime) override;
|
virtual void Tick(float DeltaTime) override;
|
||||||
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
#include "Weapon/Weapon.h"
|
#include "Weapon/Weapon.h"
|
||||||
|
|
||||||
|
#include "Character/D2BaseCharacter.h"
|
||||||
#include "Components/SphereComponent.h"
|
#include "Components/SphereComponent.h"
|
||||||
|
#include "Components/WidgetComponent.h"
|
||||||
|
|
||||||
AWeapon::AWeapon()
|
AWeapon::AWeapon()
|
||||||
{
|
{
|
||||||
|
@ -23,16 +25,30 @@ AWeapon::AWeapon()
|
||||||
AreaSphere->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore);
|
AreaSphere->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore);
|
||||||
AreaSphere->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
AreaSphere->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
||||||
|
|
||||||
if(HasAuthority())
|
PickupWidget = CreateDefaultSubobject<UWidgetComponent>(TEXT("PickupWidget"));
|
||||||
{
|
PickupWidget->SetupAttachment(RootComponent);
|
||||||
AreaSphere->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
|
|
||||||
AreaSphere->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Overlap);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AWeapon::BeginPlay()
|
void AWeapon::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::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<AD2BaseCharacter>(OtherActor);
|
||||||
|
if(BaseCharacter && PickupWidget)
|
||||||
|
PickupWidget->SetVisibility(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AWeapon::Tick(float DeltaTime)
|
void AWeapon::Tick(float DeltaTime)
|
||||||
|
|
|
@ -26,7 +26,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
UFUNCTION()
|
||||||
|
virtual void OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void Tick(float DeltaTime) override;
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
|
||||||
|
@ -37,6 +39,9 @@ private:
|
||||||
UPROPERTY(VisibleAnywhere, Category = "Weapon Properties")
|
UPROPERTY(VisibleAnywhere, Category = "Weapon Properties")
|
||||||
TObjectPtr<class USphereComponent> AreaSphere;
|
TObjectPtr<class USphereComponent> AreaSphere;
|
||||||
|
|
||||||
UPROPERTY(VisibleAnywhere)
|
UPROPERTY(VisibleAnywhere, Category = "Weapon Properties")
|
||||||
EWeaponState WeaponState;
|
EWeaponState WeaponState;
|
||||||
|
|
||||||
|
UPROPERTY(VisibleAnywhere, Category = "Weapon Properties")
|
||||||
|
TObjectPtr<class UWidgetComponent> PickupWidget;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue