diff --git a/Content/IntegrationGameModeBaseBP.uasset b/Content/IntegrationGameModeBaseBP.uasset index 18945ea8..1263239d 100644 --- a/Content/IntegrationGameModeBaseBP.uasset +++ b/Content/IntegrationGameModeBaseBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d0e627f55fd73f0e5876ed299b2f29e9fe9dfaa94dafbe90c484ac32874ac808 -size 54056 +oid sha256:35aecf64788f3be542623a2483fae2cec2d5cf6f9687570274e67a43d50a7db7 +size 53913 diff --git a/Content/TanActor.uasset b/Content/TanActor.uasset new file mode 100644 index 00000000..e535ab0e --- /dev/null +++ b/Content/TanActor.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16facac2515f1247a8d763794c7b7db3f3d855c1a6a772ae429cdb67e60e941c +size 36344 diff --git a/Content/TangibleActor.uasset b/Content/TangibleActor.uasset deleted file mode 100644 index a94642e8..00000000 --- a/Content/TangibleActor.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:da60f617e9dee01bb356f95c3e539d403c0adc101c0ceabb60145a82789a4a85 -size 28327 diff --git a/Content/TangibleComponent.uasset b/Content/TangibleComponent.uasset deleted file mode 100644 index b19f2151..00000000 --- a/Content/TangibleComponent.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:00eccd12e5d7bc2db10e8c6635337b34be9f3f552603dc041315d6ebf6116e77 -size 13383 diff --git a/Content/__ExternalActors__/LpxLevel/E/4Q/3EJ0O2NJBUVLG13CK094EE.uasset b/Content/__ExternalActors__/LpxLevel/E/4Q/3EJ0O2NJBUVLG13CK094EE.uasset new file mode 100644 index 00000000..aa6d1f99 --- /dev/null +++ b/Content/__ExternalActors__/LpxLevel/E/4Q/3EJ0O2NJBUVLG13CK094EE.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63f6763e6264a9a92887af4285996d80fb3312caeb5e3debf5a2d2bf3d31b568 +size 4139 diff --git a/Source/Integration/IntegrationGameModeBase.cpp b/Source/Integration/IntegrationGameModeBase.cpp index 0b0d73d2..b90e0905 100644 --- a/Source/Integration/IntegrationGameModeBase.cpp +++ b/Source/Integration/IntegrationGameModeBase.cpp @@ -4,6 +4,7 @@ #include "lpx-drvutil.hpp" #include "DebugPrint.h" #include "TangibleManager.h" +#include "TangibleInterface.h" #include "CommonTypes.h" #include "AnimQueue.h" #include @@ -68,6 +69,7 @@ void AIntegrationGameModeBase::ResetToInitialState() // Reset the clocks. EngineSeconds = 0; NextThreadTrigger = 1.0; + NextRotateCube = 1.0; } @@ -94,14 +96,10 @@ void AIntegrationGameModeBase::UpdateConsoleOutput() { void AIntegrationGameModeBase::MaybeTriggerUpdateTask(float deltaseconds) { if (!Playing) return; FLockedWrapper lockedwrap(LockableWrapper); - if (lockedwrap->engine != nullptr) + if (EngineSeconds >= NextThreadTrigger) { - EngineSeconds += deltaseconds; - if (EngineSeconds >= NextThreadTrigger) - { - LuprexUpdateTask.Trigger(); - NextThreadTrigger += 0.05; - } + LuprexUpdateTask.Trigger(); + NextThreadTrigger += 0.05; } } @@ -119,6 +117,19 @@ void AIntegrationGameModeBase::UpdateTangibles() { for (int i = 0; i < aqueues.Num(); i++) { FString debugq = FAnimQueueDecoder::DebugString(aqueues[i]); } + // Tick all the tangibles. + if (EngineSeconds > NextRotateCube) { + for (int i = 0; i < live.Num(); i++) { + AActor* a = TangibleManager.GetTangible(live[i]); + check(a != nullptr); + bool hasInterface = a->GetClass()->ImplementsInterface(UTangibleInterface::StaticClass()); + if (hasInterface) { + ITangibleInterface* iface = Cast(a); + iface->Execute_TurnFromCXX(a); + } + } + NextRotateCube += 0.5; + } } void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs) @@ -142,6 +153,11 @@ void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs) void AIntegrationGameModeBase::Tick(float deltaseconds) { Super::Tick(deltaseconds); + if (Playing) + { + EngineSeconds += deltaseconds; + } + UpdateConsoleOutput(); UpdateTangibles(); MaybeTriggerUpdateTask(deltaseconds); diff --git a/Source/Integration/IntegrationGameModeBase.h b/Source/Integration/IntegrationGameModeBase.h index df0c359f..41b21378 100644 --- a/Source/Integration/IntegrationGameModeBase.h +++ b/Source/Integration/IntegrationGameModeBase.h @@ -76,9 +76,12 @@ public: // bool Playing; - // Amount of elapsed time. + // Amount of elapsed time since BeginPlay. float EngineSeconds; - // When do we next trigger the thread event (relative to EngineSeconds). + // When do we next trigger the thread event. float NextThreadTrigger; + + // When do we next rotate the cube. + float NextRotateCube; }; diff --git a/Source/Integration/TangibleComponentBase.cpp b/Source/Integration/TangibleComponentBase.cpp deleted file mode 100644 index 6185bef3..00000000 --- a/Source/Integration/TangibleComponentBase.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - -#include "TangibleComponentBase.h" - -// Sets default values for this component's properties -UTangibleComponentBase::UTangibleComponentBase() -{ - // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features - // off to improve performance if you don't need them. - PrimaryComponentTick.bCanEverTick = true; - - // ... -} - - -// Called when the game starts -void UTangibleComponentBase::BeginPlay() -{ - Super::BeginPlay(); - - // ... - -} - - -// Called every frame -void UTangibleComponentBase::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) -{ - Super::TickComponent(DeltaTime, TickType, ThisTickFunction); - - // ... -} - diff --git a/Source/Integration/TangibleComponentBase.h b/Source/Integration/TangibleComponentBase.h deleted file mode 100644 index d3a84e04..00000000 --- a/Source/Integration/TangibleComponentBase.h +++ /dev/null @@ -1,28 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#pragma once - -#include "CoreMinimal.h" -#include "Components/ActorComponent.h" -#include "TangibleComponentBase.generated.h" - - -UCLASS(Blueprintable, BlueprintType, ClassGroup = (Custom), meta = (BlueprintSpawnableComponent), ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) -class INTEGRATION_API UTangibleComponentBase : public UActorComponent -{ - GENERATED_BODY() - -public: - // Sets default values for this component's properties - UTangibleComponentBase(); - -protected: - // Called when the game starts - virtual void BeginPlay() override; - -public: - // Called every frame - virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; - - -}; diff --git a/Source/Integration/TangibleInterface.cpp b/Source/Integration/TangibleInterface.cpp new file mode 100644 index 00000000..8027fd0f --- /dev/null +++ b/Source/Integration/TangibleInterface.cpp @@ -0,0 +1,6 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "TangibleInterface.h" + +// Add default functionality here for any ITangibleInterface functions that are not pure virtual. diff --git a/Source/Integration/TangibleInterface.h b/Source/Integration/TangibleInterface.h new file mode 100644 index 00000000..4ba55ff7 --- /dev/null +++ b/Source/Integration/TangibleInterface.h @@ -0,0 +1,27 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "UObject/Interface.h" +#include "TangibleInterface.generated.h" + +// This class does not need to be modified. +UINTERFACE(MinimalAPI) +class UTangibleInterface : public UInterface +{ + GENERATED_BODY() +}; + +/** + * + */ +class INTEGRATION_API ITangibleInterface +{ + GENERATED_BODY() + + // Add interface functions to this class. This is the class that will be inherited to implement this interface. +public: + UFUNCTION(BlueprintCallable, BlueprintImplementableEvent, Category = "Tangible Functionality") + void TurnFromCXX(); +};