23 #include "CoreMinimal.h"
24 #include "GameFramework/Actor.h"
25 #include "UObject/WeakInterfacePtr.h"
27 #include "ApparatusRuntime.h"
29 #include "Mechanical.h"
30 #include "SubjectiveActorComponent.h"
31 #include "SubjectiveUserWidget.h"
32 #include "Mechanical.h"
34 #include "MechanicalGameModeBase.generated.h"
49 mutable class UBelt* BufferingBelt =
nullptr;
54 UPROPERTY(EditAnywhere, Category = Mechanism,
55 Meta = (AllowPrivateAccess =
"true"))
56 float SteadyDeltaTime = 1.0f / 30.0f;
77 virtual void BeginPlay()
override;
82 virtual void EndPlay(
const EEndPlayReason::Type EndPlayReason)
override;
86 if (BufferingBelt ==
nullptr)
95 virtual void Tick(
float DeltaTime)
override;
100 UFUNCTION(BlueprintCallable, BlueprintPure)
101 FORCEINLINE
float GetProcessedSteadyTime()
const
103 return DoGetProcessedSteadyTime(SteadyDeltaTime);
113 UFUNCTION(BlueprintCallable, BlueprintPure,
114 Category =
"Apparatus|Mechanism",
115 Meta = (DisplayName =
"Steady Frame Ratio", Keywords =
"get"))
116 FORCEINLINE
float CalcSteadyFrameRatio()
const
118 return DoCalcSteadyFrameRatio(GetGameTimeSinceCreation(),
128 UFUNCTION(BlueprintCallable, BlueprintPure,
129 Category =
"Apparatus|Mechanism",
130 Meta = (DisplayName =
"Steady Future Factor", Keywords =
"get ratio"))
131 FORCEINLINE
float CalcSteadyFutureFactor()
const
133 return DoCalcSteadyFutureFactor(GetGameTimeSinceCreation(),
140 UFUNCTION(BlueprintCallable, BlueprintPure,
141 Category =
"Apparatus|Mechanism",
142 Meta = (DisplayName =
"Steady Frame", Keywords =
"get"))
143 FORCEINLINE int32 GetSteadyFrame()
const
151 UFUNCTION(BlueprintCallable, BlueprintPure,
152 Category =
"Apparatus|Mechanism",
153 Meta = (DisplayName =
"Steady Time", Keywords =
"get"))
154 FORCEINLINE
float GetSteadyTime()
const
156 return GetSteadyFrame() * SteadyDeltaTime;
162 PrimaryActorTick.bCanEverTick =
true;
178 Super::EndPlay(EndPlayReason);
183 DoTick(GetGameTimeSinceCreation(),
The base game mode mechanism facility.
Definition: MechanicalGameModeBase.h:42
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override
End executing the mechanism.
Definition: MechanicalGameModeBase.h:175
~AMechanicalGameModeBase()
Destroy the mechanism.
Definition: MechanicalGameModeBase.h:165
virtual UBelt * GetBufferingBelt() const override
A special callback to process a newly created subjects boot process.
Definition: MechanicalGameModeBase.h:84
AMechanicalGameModeBase()
Construct a new mechanism.
Definition: MechanicalGameModeBase.h:160
virtual void BeginPlay() override
Begin executing the mechanism.
Definition: MechanicalGameModeBase.h:169
virtual void Tick(float DeltaTime) override
Definition: MechanicalGameModeBase.h:181
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