5 #include "CoreMinimal.h"
6 #include "GameFramework/GameMode.h"
8 #include "ApparatusRuntime.h"
10 #include "Mechanical.h"
11 #include "SubjectiveActorComponent.h"
12 #include "SubjectiveUserWidget.h"
13 #include "Mechanical.h"
15 #include "MechanicalGameMode.generated.h"
29 mutable class UBelt* BufferingBelt =
nullptr;
34 UPROPERTY(EditAnywhere, Category = Mechanism,
35 Meta = (AllowPrivateAccess =
"true"))
36 float SteadyDeltaTime = 1.0f / 30.0f;
57 virtual void BeginPlay()
override;
62 virtual void EndPlay(
const EEndPlayReason::Type EndPlayReason)
override;
66 if (BufferingBelt ==
nullptr)
75 virtual void Tick(
float DeltaTime)
override;
80 UFUNCTION(BlueprintCallable, BlueprintPure)
81 FORCEINLINE
float GetProcessedSteadyTime()
const
83 return DoGetProcessedSteadyTime(SteadyDeltaTime);
93 UFUNCTION(BlueprintCallable, BlueprintPure,
94 Category =
"Apparatus|Mechanism",
95 Meta = (DisplayName =
"Steady Frame Ratio", Keywords =
"get"))
96 FORCEINLINE
float CalcSteadyFrameRatio()
const
98 return DoCalcSteadyFrameRatio(GetGameTimeSinceCreation(),
108 UFUNCTION(BlueprintCallable, BlueprintPure,
109 Category =
"Apparatus|Mechanism",
110 Meta = (DisplayName =
"Steady Future Factor", Keywords =
"get ratio"))
111 FORCEINLINE
float CalcSteadyFutureFactor()
const
113 return DoCalcSteadyFutureFactor(GetGameTimeSinceCreation(),
120 UFUNCTION(BlueprintCallable, BlueprintPure,
121 Category =
"Apparatus|Mechanism",
122 Meta = (DisplayName =
"Steady Frame", Keywords =
"get"))
123 FORCEINLINE int32 GetSteadyFrame()
const
131 UFUNCTION(BlueprintCallable, BlueprintPure,
132 Category =
"Apparatus|Mechanism",
133 Meta = (DisplayName =
"Steady Time", Keywords =
"get"))
134 FORCEINLINE
float GetSteadyTime()
const
136 return GetSteadyFrame() * SteadyDeltaTime;
142 PrimaryActorTick.bCanEverTick =
true;
158 Super::EndPlay(EndPlayReason);
163 DoTick(GetGameTimeSinceCreation(),
The game mode mechanism facility.
Definition: MechanicalGameMode.h:22
virtual UBelt * GetBufferingBelt() const override
A special callback to process a newly created subjects boot process.
Definition: MechanicalGameMode.h:64
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override
End executing the mechanism.
Definition: MechanicalGameMode.h:155
AMechanicalGameMode()
Construct a new mechanism.
Definition: MechanicalGameMode.h:140
virtual void Tick(float DeltaTime) override
Definition: MechanicalGameMode.h:161
virtual void BeginPlay() override
Begin executing the mechanism.
Definition: MechanicalGameMode.h:149
~AMechanicalGameMode()
Destroy the mechanism.
Definition: MechanicalGameMode.h:145
A common interface for all mechanisms.
Definition: Mechanical.h:43
virtual void DoTick(float NewTime, float DeltaTime, float SteadyDeltaTime)
Perform a standard ticking routine.
Definition: Mechanical.h:230
An interface for all sorts of subjects.
Definition: Subjective.h:42
The conveyor belt consisting of subjects.
Definition: Belt.h:60
static class UBelt * NewBuffering(UObject *Owner)
Create a new buffering belt instance.
Definition: Belt.cpp:80
The base subject detail (component) class.
Definition: Detail.h:35
static void RegisterMechanical(TScriptInterface< IMechanical > Mechanical)
Register a mechanical within the mechanism.
Definition: Mechanism.h:384
static void UnregisterMechanical(TScriptInterface< IMechanical > Mechanical)
Unregister a mechanical from the mechanism.
Definition: Mechanism.h:266