Add campfire smoke placeholder
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "AgrarianGameCharacter.h"
|
||||
#include "AgrarianInventoryComponent.h"
|
||||
#include "AgrarianSurvivalComponent.h"
|
||||
#include "Particles/ParticleSystemComponent.h"
|
||||
#include "Components/PointLightComponent.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
@@ -22,6 +23,12 @@ AAgrarianCampfire::AAgrarianCampfire()
|
||||
FireLight->SetIntensity(0.0f);
|
||||
FireLight->SetAttenuationRadius(WarmthRadius);
|
||||
FireLight->SetLightColor(FLinearColor(1.0f, 0.45f, 0.18f));
|
||||
|
||||
SmokeEffect = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("SmokeEffect"));
|
||||
SmokeEffect->SetupAttachment(RootComponent);
|
||||
SmokeEffect->bAutoActivate = false;
|
||||
SmokeEffect->SetRelativeLocation(FVector(0.0f, 0.0f, 80.0f));
|
||||
SmokeEffect->SetVisibility(false);
|
||||
}
|
||||
|
||||
void AAgrarianCampfire::Tick(float DeltaSeconds)
|
||||
@@ -140,6 +147,19 @@ void AAgrarianCampfire::UpdateVisualState()
|
||||
{
|
||||
FireLight->SetIntensity(bLit ? 4200.0f : 0.0f);
|
||||
}
|
||||
|
||||
if (SmokeEffect)
|
||||
{
|
||||
SmokeEffect->SetVisibility(bLit);
|
||||
if (bLit)
|
||||
{
|
||||
SmokeEffect->ActivateSystem();
|
||||
}
|
||||
else
|
||||
{
|
||||
SmokeEffect->DeactivateSystem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AAgrarianCampfire::WarmNearbyCharacters(float DeltaSeconds)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "AgrarianCampfire.generated.h"
|
||||
|
||||
class UPointLightComponent;
|
||||
class UParticleSystemComponent;
|
||||
class UStaticMeshComponent;
|
||||
|
||||
UCLASS(Blueprintable)
|
||||
@@ -27,6 +28,9 @@ public:
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Fire")
|
||||
TObjectPtr<UPointLightComponent> FireLight;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Fire|Effects")
|
||||
TObjectPtr<UParticleSystemComponent> SmokeEffect;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing = OnRep_FireState, Category = "Agrarian|Fire")
|
||||
bool bLit = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user