jordonbc

Header File

Nov 7th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.91 KB | None | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #pragma once
  4.  
  5. #include "Runtime/Engine/Classes/Materials/MaterialParameterCollection.h"
  6. #include "Runtime/CoreUObject/Public/UObject/Class.h"
  7. #include "Runtime/Engine/Classes/Kismet/KismetMaterialLibrary.h"
  8.  
  9. #include "Runtime/Engine/Classes/Materials/MaterialParameterCollectionInstance.h"
  10. #include "TimerManager.h"
  11. #include "Engine/World.h"
  12. #include "ConstructorHelpers.h"
  13. #include "Runtime/Engine/Classes/Particles/ParticleSystemComponent.h"
  14. #include "Runtime/Engine/Classes/Engine/DirectionalLight.h"
  15. #include "Core.h"
  16.  
  17. #include "GameFramework/Actor.h"
  18. #include "DynamicSkysphereController.generated.h"
  19.  
  20. UENUM(BlueprintType)
  21.  
  22. enum EWeather
  23. {
  24.     Sunny,
  25.     Raining,
  26.     Snowing
  27. };
  28.  
  29. UCLASS()
  30. class SWCPP_API ADynamicSkysphereController : public AActor
  31. {
  32.     GENERATED_BODY()
  33.  
  34. public:
  35.  
  36.     FTimerHandle WeatherTimerHandle;
  37.  
  38.     UPROPERTY(EditAnywhere)
  39.         bool ForceResetTimer = false;
  40.     UPROPERTY(EditAnywhere)
  41.         bool ForceUpdateWeather = false;
  42.  
  43.     UPROPERTY(VisibleAnywhere, Category = "Weather")
  44.         int WeatherTimerMinimumInSeconds;
  45.  
  46.     UPROPERTY(VisibleAnywhere, Category = "Weather")
  47.         int WeatherTimerMaximumInSeconds;
  48.  
  49.     UPROPERTY(EditAnywhere, BlueprintReadwrite, Category = "Weather")
  50.         float WeatherTimerMaximumInMinutes = 2;
  51.  
  52.     UPROPERTY(EditAnywhere, BlueprintReadwrite, Category = "Weather")
  53.         float WeatherTimerMinimumInMinutes = 1;
  54.  
  55.     UPROPERTY(VisibleAnywhere, Category = "Weather")
  56.         int TimeBeforeWeatherChangeInSeconds;
  57.  
  58.  
  59.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Date")
  60.         int Day = 0;
  61.  
  62.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Date")
  63.         int Month = 0;
  64.  
  65.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Date")
  66.         int Year = 0;
  67.  
  68.     UPROPERTY(EditAnywhere, BlueprintReadwrite, Category = "Day/Night Cycle")
  69.         float DayLengthInMinutes = 1;
  70.  
  71.     UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Day/Night Cycle")
  72.         float CurrentHour;
  73.  
  74.     UPROPERTY(VisibleAnywhere, Category = "Day/Night Cycle")
  75.         float SunAngle;
  76.  
  77.     UPROPERTY(EditAnywhere, BlueprintReadwrite, Category = "Day/Night Cycle")
  78.         float HourOffset = 0;
  79.  
  80.     UPROPERTY(EditAnywhere, BlueprintReadwrite, Category = "Day/Night Cycle")
  81.         float MaxSunIntensity = 10;
  82.  
  83.     UPROPERTY(EditAnywhere, BlueprintReadwrite, Category = "Day/Night Cycle")
  84.         float SpeedOfSunRiseAndFall = 5;
  85.  
  86.     UPROPERTY(EditAnywhere, BlueprintReadwrite, Category = "Day/Night Cycle")
  87.         ADirectionalLight* Sun;
  88.  
  89.     UPROPERTY(EditAnywhere, BlueprintReadwrite, Category = "Day/Night Cycle")
  90.         AActor* Skysphere;
  91.  
  92.     UPROPERTY(BlueprintReadOnly, Category = "Day/Night Cycle")
  93.         float OneDayInSeconds;
  94.  
  95.     UPROPERTY(BlueprintReadOnly, Category = "Day/Night Cycle")
  96.         float OneHour;
  97.  
  98.     UPROPERTY(BlueprintReadOnly, Category = "Day/Night Cycle")
  99.         float DeltaSpeedOfSun;
  100.  
  101.     UPROPERTY(BlueprintReadOnly, Category = "Day/Night Cycle")
  102.         float CurrentInterpValue;
  103.  
  104.     UPROPERTY()
  105.         class UParticleSystemComponent* PSRain;
  106.  
  107.     UPROPERTY()
  108.         class UParticleSystemComponent* PSSnow;
  109.  
  110.     UPROPERTY(EditAnywhere, BlueprintReadwrite, Category = "Weather")
  111.         TEnumAsByte<EWeather> CurrentWeather;
  112.  
  113.     UMaterialParameterCollectionInstance* matParamInst;
  114.     UMaterialParameterCollection* matParam;
  115.     UWorld* worldContext;
  116. private:
  117.     void Lights();
  118.     void IncrementDay();
  119.     void PickRandomInteger();
  120.     void ChooseRandomWeather();
  121.     void setValues();
  122.     void UpdateWeather();
  123.     void ChangeWeather();
  124.    
  125. public:
  126.     // Sets default values for this actor's properties
  127.     ADynamicSkysphereController();
  128.  
  129. protected:
  130.     // Called when the game starts or when spawned
  131.     virtual void BeginPlay() override;
  132.  
  133. public:
  134.     // Called every frame
  135.     virtual void Tick(float DeltaTime) override;
  136.  
  137.     UFUNCTION(BlueprintCallable, BlueprintPure)
  138.         bool IsRaining();
  139.     UFUNCTION(BlueprintCallable, BlueprintPure)
  140.         bool IsSnowing();
  141.     UFUNCTION(BlueprintCallable, BlueprintPure)
  142.         bool IsSunny();
  143.  
  144.    
  145.    
  146. };
Add Comment
Please, Sign In to add comment