diff --git a/BuildingEscape.uproject b/BuildingEscape.uproject index cebd07e..a517dc0 100644 --- a/BuildingEscape.uproject +++ b/BuildingEscape.uproject @@ -18,6 +18,17 @@ { "Name": "OculusVR", "Enabled": false + }, + { + "Name": "MeshEditor", + "Enabled": true + }, + { + "Name": "Shotgun", + "Enabled": true, + "SupportedTargetPlatforms": [ + "Win64" + ] } ], "TargetPlatforms": [ diff --git a/Content/Levels/VillaDesign.umap b/Content/Levels/VillaDesign.umap index 951f81b..46a1430 100644 Binary files a/Content/Levels/VillaDesign.umap and b/Content/Levels/VillaDesign.umap differ diff --git a/Content/Levels/VillaDesign_BuiltData.uasset b/Content/Levels/VillaDesign_BuiltData.uasset index e2aad91..ca425b8 100644 Binary files a/Content/Levels/VillaDesign_BuiltData.uasset and b/Content/Levels/VillaDesign_BuiltData.uasset differ diff --git a/Content/ModularFantasyHouse/Meshes/SM_Wall_Stone_Slopped.uasset b/Content/ModularFantasyHouse/Meshes/SM_Wall_Stone_Slopped.uasset new file mode 100644 index 0000000..c3c775c Binary files /dev/null and b/Content/ModularFantasyHouse/Meshes/SM_Wall_Stone_Slopped.uasset differ diff --git a/Source/BuildingEscape/OpenDoor.cpp b/Source/BuildingEscape/OpenDoor.cpp index f39c94f..41a3858 100644 --- a/Source/BuildingEscape/OpenDoor.cpp +++ b/Source/BuildingEscape/OpenDoor.cpp @@ -50,7 +50,7 @@ void UOpenDoor::OpenDoor() { FRotator rotation = GetOwner()->GetActorRotation(); rotation.Yaw = TargetAngle; - rotate(rotation); + Rotate(rotation); open = true; } @@ -58,7 +58,7 @@ void UOpenDoor::CloseDoor() { FRotator rotation = GetOwner()->GetActorRotation(); rotation.Yaw = 0.0f; - rotate(rotation); + Rotate(rotation); open = false; } diff --git a/Source/BuildingEscape/RotatingActor.cpp b/Source/BuildingEscape/RotatingActor.cpp index 7296adb..154282c 100644 --- a/Source/BuildingEscape/RotatingActor.cpp +++ b/Source/BuildingEscape/RotatingActor.cpp @@ -26,16 +26,21 @@ void URotatingActor::TickComponent(float DeltaTime, ELevelTick TickType, FActorC rotating = false; }else { - - GetOwner()->AddActorLocalRotation(DeltaTime * RotationSpeed * FRotator(0.0f, 1.0f, 0.0f)); + GetOwner()->AddActorLocalRotation(DeltaTime * RotationSpeed * FRotator(0.0f, tempRotation, 0.0f)); } } } -void URotatingActor::rotate(FRotator targetRotation) +void URotatingActor::Rotate(const FRotator TargetRotation) { - this->targetRotation = targetRotation; + this->targetRotation = TargetRotation; rotating = true; + tempRotation = (TargetRotation.Yaw < 0) ? -1.f : 1.f; + if(Negative) + { + tempRotation = (TargetRotation.Yaw < 0) ? 1.f : -1.f; + } + if(AudioComponent != nullptr && !soundHasBeenPlayed) { AudioComponent->Play(); @@ -43,10 +48,10 @@ void URotatingActor::rotate(FRotator targetRotation) } } -void URotatingActor::rotate() +void URotatingActor::Rotate() { FRotator rotation = GetOwner()->GetActorRotation(); rotation.Yaw = TargetAngle; - rotate(rotation); + Rotate(rotation); } diff --git a/Source/BuildingEscape/RotatingActor.h b/Source/BuildingEscape/RotatingActor.h index 42c14f9..ff0b0a4 100644 --- a/Source/BuildingEscape/RotatingActor.h +++ b/Source/BuildingEscape/RotatingActor.h @@ -18,8 +18,11 @@ public: protected: virtual void BeginPlay() override; - void rotate(FRotator targetRotation); - void rotate(); + + void Rotate(FRotator TargetRotation); + + UFUNCTION() + void Rotate(); public: virtual void TickComponent(float DeltaTime, ELevelTick TickType, @@ -37,8 +40,12 @@ public: UPROPERTY(EditAnywhere) float RotationDelay = 2.f; + UPROPERTY(EditAnywhere) + bool Negative = false; + private: FRotator targetRotation; bool rotating; bool soundHasBeenPlayed; + float tempRotation; }; diff --git a/Source/BuildingEscape/TriggerOpenDoor.cpp b/Source/BuildingEscape/TriggerOpenDoor.cpp index cbd1c0c..38d0f9e 100644 --- a/Source/BuildingEscape/TriggerOpenDoor.cpp +++ b/Source/BuildingEscape/TriggerOpenDoor.cpp @@ -29,6 +29,6 @@ void UTriggerOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, TriggerVolume->GetOverlappingActors(overlappingActors); if (overlappingActors.Num() >= 1) { - rotate(); + Rotate(); } }