23 #include "CoreMinimal.h"
24 #include "GameFramework/Actor.h"
26 #include "Mechanism.h"
27 #include "Mechanical.h"
29 #include "ApparatusRuntime.h"
31 #include "MechanicalActor.generated.h"
46 mutable class UBelt* BufferingBelt =
nullptr;
51 UPROPERTY(EditAnywhere, Category = Mechanism,
52 Meta = (AllowPrivateAccess =
"true"))
53 float SteadyDeltaTime = 1.0f / 30.0f;
70 virtual void BeginPlay()
override;
75 virtual void EndPlay(
const EEndPlayReason::Type EndPlayReason)
override;
79 if (BufferingBelt ==
nullptr)
88 virtual void Tick(
float DeltaTime)
override;
93 UFUNCTION(BlueprintCallable, BlueprintPure,
94 Category =
"Apparatus|Mechanism",
95 Meta = (DisplayName =
"Processed Steady Time", Keywords =
"get"))
96 FORCEINLINE
float GetProcessedSteadyTime()
const
98 return DoGetProcessedSteadyTime(SteadyDeltaTime);
108 UFUNCTION(BlueprintCallable, BlueprintPure,
109 Category =
"Apparatus|Mechanism",
110 Meta = (DisplayName =
"Steady Frame Ratio", Keywords =
"get"))
111 FORCEINLINE
float CalcSteadyFrameRatio()
const
113 return DoCalcSteadyFrameRatio(GetGameTimeSinceCreation(),
123 UFUNCTION(BlueprintCallable, BlueprintPure,
124 Category =
"Apparatus|Mechanism",
125 Meta = (DisplayName =
"Steady Future Factor", Keywords =
"get ratio"))
126 FORCEINLINE
float CalcSteadyFutureFactor()
const
128 return DoCalcSteadyFutureFactor(GetGameTimeSinceCreation(),
135 UFUNCTION(BlueprintCallable, BlueprintPure,
136 Category =
"Apparatus|Mechanism",
137 Meta = (DisplayName =
"Steady Frame", Keywords =
"get"))
138 FORCEINLINE int32 GetSteadyFrame()
const
146 UFUNCTION(BlueprintCallable, BlueprintPure,
147 Category =
"Apparatus|Mechanism",
148 Meta = (DisplayName =
"Steady Time", Keywords =
"get"))
149 FORCEINLINE
float GetSteadyTime()
const
151 return GetSteadyFrame() * SteadyDeltaTime;
157 PrimaryActorTick.bCanEverTick =
true;
172 Super::EndPlay(EndPlayReason);
177 DoTick(GetGameTimeSinceCreation(),
The mechanical actor entity.
Definition: MechanicalActor.h:39
~AMechanicalActor()
Destroy the mechanism.
Definition: MechanicalActor.h:160
virtual void BeginPlay() override
Begin executing the mechanism.
Definition: MechanicalActor.h:163
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override
End executing the mechanism.
Definition: MechanicalActor.h:169
AMechanicalActor()
Construct a new mechanism.
Definition: MechanicalActor.h:155
virtual void Tick(float DeltaTime) override
Definition: MechanicalActor.h:175
virtual UBelt * GetBufferingBelt() const override
A special callback to process a newly created subjects boot process.
Definition: MechanicalActor.h:77
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
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
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