Replace Pickup Sprite Component with Static Mesh Component
This commit is contained in:
parent
cc671d5b70
commit
3f75cb5db9
BIN
Content/Materials/M_EXPGlow.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Materials/M_EXPGlow.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Materials/M_GoldGlow.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Materials/M_GoldGlow.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Meshes/SM_Coin.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Meshes/SM_Coin.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Meshes/SM_EXP.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Meshes/SM_EXP.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Pickups/EXP/BP_BlueEXPPickup.uasset
(Stored with Git LFS)
BIN
Content/Pickups/EXP/BP_BlueEXPPickup.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Pickups/EXP/BP_PickupTemplate.uasset
(Stored with Git LFS)
BIN
Content/Pickups/EXP/BP_PickupTemplate.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Pickups/EXP/DA_BlueEXPPickup.uasset
(Stored with Git LFS)
BIN
Content/Pickups/EXP/DA_BlueEXPPickup.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Pickups/Gold/BP_GoldPickup.uasset
(Stored with Git LFS)
BIN
Content/Pickups/Gold/BP_GoldPickup.uasset
(Stored with Git LFS)
Binary file not shown.
@ -7,7 +7,6 @@
|
||||
#include "PlayerCharacter.h"
|
||||
#include "Components/SphereComponent.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "PaperSpriteComponent.h"
|
||||
#include "PickupDataAsset.h"
|
||||
#include "GameFramework/GameModeBase.h"
|
||||
#include "Interfaces/Pools.h"
|
||||
@ -27,11 +26,11 @@ APickup::APickup()
|
||||
OuterSphereComponent->AttachToComponent(RootComponent, FAttachmentTransformRules::KeepRelativeTransform);
|
||||
OuterSphereComponent->SetSphereRadius(250.0f);
|
||||
|
||||
SpriteComponent = CreateDefaultSubobject<UPaperSpriteComponent>(TEXT("Sprite Component"));
|
||||
SpriteComponent->SetRelativeRotation(FRotator(0.0f, 90.0f, -90.0f));
|
||||
SpriteComponent->SetRelativeScale3D(FVector(.5f, .5f, .5f));
|
||||
SpriteComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
||||
SpriteComponent->SetupAttachment(RootComponent);
|
||||
StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Static Mesh Component"));
|
||||
StaticMeshComponent->SetRelativeRotation(FRotator(0.0f, 90.0f, 0.0f));
|
||||
StaticMeshComponent->SetRelativeScale3D(FVector(.5f, .5f, .5f));
|
||||
StaticMeshComponent->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
||||
StaticMeshComponent->SetupAttachment(RootComponent);
|
||||
|
||||
TimelineComponent = CreateDefaultSubobject<UTimelineComponent>(TEXT("Timeline Component"));
|
||||
TimelineComponent->SetDirectionPropertyName(FName("TimelineDirection"));
|
||||
@ -64,7 +63,7 @@ void APickup::LoadDataFromDataAsset_Implementation(UPickupDataAsset* PickupDataA
|
||||
if (PickupDataAsset != nullptr)
|
||||
{
|
||||
PickupValue = PickupDataAsset->PickupValue;
|
||||
SpriteComponent->SetSprite(PickupDataAsset->PickupSprite);
|
||||
StaticMeshComponent->SetStaticMesh(PickupDataAsset->PickupStaticMesh);
|
||||
PickupSoundBase = PickupDataAsset->PickupSoundBase;
|
||||
CurveFloat = PickupDataAsset->CurveFloat;
|
||||
|
||||
@ -79,7 +78,7 @@ void APickup::LoadDataFromDataAsset_Implementation(UPickupDataAsset* PickupDataA
|
||||
void APickup::ResetData_Implementation()
|
||||
{
|
||||
PickupValue = 0;
|
||||
SpriteComponent->SetSprite(nullptr);
|
||||
StaticMeshComponent->SetStaticMesh(nullptr);
|
||||
PickupSoundBase = nullptr;
|
||||
CurveFloat = nullptr;
|
||||
|
||||
@ -123,19 +122,7 @@ void APickup::OnOuterBeginOverlap(UPrimitiveComponent* OverlappedComponent, AAct
|
||||
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
|
||||
const FHitResult& SweepResult)
|
||||
{
|
||||
if (APlayerCharacter* PlayerCharacter = Cast<APlayerCharacter>(OtherActor))
|
||||
{
|
||||
PickupLocation = GetActorLocation();
|
||||
PlayTimeLine();
|
||||
|
||||
double dist = FVector::Distance(GetActorLocation(), PlayerCharacter->GetActorLocation());
|
||||
|
||||
if (dist < OuterSphereComponent->GetScaledSphereRadius())
|
||||
{
|
||||
double ratio = FMath::Abs((dist / OuterSphereComponent->GetScaledSphereRadius()) - 1.0f);
|
||||
TimelineComponent->SetNewTime(ratio);
|
||||
}
|
||||
}
|
||||
PlayTimeLine();
|
||||
}
|
||||
|
||||
void APickup::TimelineCallback(float val)
|
||||
@ -152,5 +139,5 @@ void APickup::TimelineFinishedCallback()
|
||||
|
||||
void APickup::PlayTimeLine()
|
||||
{
|
||||
TimelineComponent->Play();
|
||||
TimelineComponent->PlayFromStart();
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
class UPickupDataAsset;
|
||||
class UTimelineComponent;
|
||||
class USphereComponent;
|
||||
class UPaperSpriteComponent;
|
||||
|
||||
UCLASS()
|
||||
class VAMPIRES_API APickup : public AActor, public IPickupable
|
||||
@ -28,9 +27,8 @@ public:
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
USphereComponent* OuterSphereComponent = nullptr;
|
||||
|
||||
// TODO: Replace with static mesh
|
||||
UPROPERTY(EditAnywhere)
|
||||
UPaperSpriteComponent* SpriteComponent = nullptr;
|
||||
UStaticMeshComponent* StaticMeshComponent = nullptr;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
USoundBase* PickupSoundBase = nullptr;
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "PickupDataAsset.generated.h"
|
||||
|
||||
class UTimelineComponent;
|
||||
class UPaperSprite;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -20,9 +19,8 @@ public:
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Pickup Properties")
|
||||
int PickupValue = 1;
|
||||
|
||||
// TODO: Replace with static mesh
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Pickup Properties")
|
||||
TObjectPtr<UPaperSprite> PickupSprite = nullptr;
|
||||
TObjectPtr<UStaticMesh> PickupStaticMesh = nullptr;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Pickup Properties")
|
||||
TObjectPtr<USoundBase> PickupSoundBase = nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user