Files
ProjectEleri/Source/ProjectEleri/Items/SeedLogic.h
2026-07-11 10:43:52 +02:00

66 lines
1.5 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "TimerManager.h"
#include "SeedLogic.generated.h"
//DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnSeedGrowthUpdated);
//DECLARE_DYNAMIC_MULTICAST_DELEGATE(FFinishGrowth);
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class PROJECTELERI_API USeedLogic : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
USeedLogic();
UPROPERTY(BlueprintReadOnly)
int32 SecondsLeft = -2;
UPROPERTY(EditAnywhere, BlueprintReadOnly)
float WaterLevel;
//Timer handle for seed growth
FTimerHandle SeedTimerHandle;
UPROPERTY(EditAnywhere, BlueprintReadOnly)
bool Grown;
UPROPERTY(BlueprintReadOnly)
float Health;
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
UFUNCTION(BlueprintCallable)
void CheckSeedGrowth();
void TriggerSeedGrowth();
UFUNCTION(BlueprintCallable)
void WaterSeed();
void FinishSeedGrowth();
//UPROPERTY(BlueprintAssignable, Category = "Seed")
// FOnSeedGrowthUpdated OnSeedGrowthUpdated;
//UPROPERTY(BlueprintAssignable, Category = "Seed")
// FFinishGrowth OnFinishGrowth;
UFUNCTION(BlueprintCallable)
void HarvestSeed(UItem*& item, int& amount);
};