Skip to content

Commit

Permalink
Game feature (#23)
Browse files Browse the repository at this point in the history
* Convert plugin to a game feature

* Add init file

* Confirm that the component is registered

* Set camera to active on begin play

* Get UAT tool building
  • Loading branch information
HeyZoos committed Jun 12, 2022
1 parent ec84918 commit 73275ef
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 45 deletions.
4 changes: 2 additions & 2 deletions Content/AC_RTSCameraFollowMe.uasset
Git LFS file not shown
3 changes: 0 additions & 3 deletions Content/BPFL_OpenRTSCameraSystem.uasset

This file was deleted.

3 changes: 3 additions & 0 deletions Content/BPFL_RTSCameraSystem.uasset
Git LFS file not shown
3 changes: 0 additions & 3 deletions Content/BP_OpenRTSCamera.uasset

This file was deleted.

3 changes: 0 additions & 3 deletions Content/BP_OpenRTSGameMode.uasset

This file was deleted.

3 changes: 3 additions & 0 deletions Content/BP_RTSCamera.uasset
Git LFS file not shown
3 changes: 3 additions & 0 deletions Content/OpenRTSCamera.uasset
Git LFS file not shown
35 changes: 23 additions & 12 deletions OpenRTSCamera.uplugin
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "0.14.0",
"FriendlyName": "OpenRTSCamera",
"Description": "An Unreal Engine 5 open-source RTS/MOBA camera implementation that aims to be fully featured, customizable and dependable",
"Category": "Gameplay",
"BuiltInInitialFeatureState": "Active",
"CanContainContent": true,
"Category": "Game Features",
"CreatedBy": "Jesus Bracho",
"CreatedByURL": "https://github.com/HeyZoos",
"Description": "An Unreal Engine 5 open-source RTS/MOBA camera implementation that aims to be fully featured, customizable and dependable",
"DocsURL": "https://github.com/HeyZoos/OpenRTSCamera/wiki",
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/94e9872ad3754e798b6ec53f4494f5de",
"SupportURL": "https://github.com/HeyZoos/OpenRTSCamera/issues",
"CanContainContent": true,
"EnabledByDefault": false,
"EngineVersion": "5.0.0",
"ExplicitlyLoaded": true,
"FileVersion": 3,
"FriendlyName": "OpenRTSCamera",
"Installed": false,
"IsBetaVersion": false,
"IsExperimentalVersion": false,
"MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/94e9872ad3754e798b6ec53f4494f5de",
"Modules": [
{
"Name": "OpenRTSCamera",
"Name": "OpenRTSCameraRuntime",
"Type": "Runtime",
"LoadingPhase": "Default",
"PlatformAllowList": [
Expand All @@ -27,8 +29,17 @@
{
"Name": "EnhancedInput",
"Enabled": true
},
{
"Name": "GameFeatures",
"Enabled": true
},
{
"Name": "ModularGameplay",
"Enabled": true
}
],
"IsBetaVersion": false,
"IsExperimentalVersion": false
"SupportURL": "https://github.com/HeyZoos/OpenRTSCamera/issues",
"Version": 1,
"VersionName": "0.15.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

using UnrealBuildTool;

public class OpenRTSCamera : ModuleRules
public class OpenRTSCameraRuntime : ModuleRules
{
public OpenRTSCamera(ReadOnlyTargetRules Target) : base(Target)
public OpenRTSCameraRuntime(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

Expand Down Expand Up @@ -45,4 +45,4 @@ public OpenRTSCamera(ReadOnlyTargetRules Target) : base(Target)
}
);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// Copyright 2022 Jesus Bracho All Rights Reserved.

#include "OpenRTSCamera.h"
#include "OpenRTSCameraRuntimeModule.h"

#define LOCTEXT_NAMESPACE "FOpenRTSCameraModule"

void FOpenRTSCameraModule::StartupModule()
void FOpenRTSCameraRuntimeModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
}

void FOpenRTSCameraModule::ShutdownModule()
void FOpenRTSCameraRuntimeModule::ShutdownModule()
{
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
}

#undef LOCTEXT_NAMESPACE

IMPLEMENT_MODULE(FOpenRTSCameraModule, OpenRTSCamera)
IMPLEMENT_MODULE(FOpenRTSCameraRuntimeModule, OpenRTSCamera)
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void URTSCamera::BeginPlay()
this->CheckForEnhancedInputComponent();
this->BindInputMappingContext();
this->BindInputActions();
this->SetActiveCamera();
}

void URTSCamera::TickComponent(
Expand Down Expand Up @@ -312,6 +313,11 @@ void URTSCamera::BindInputActions()
}
}

void URTSCamera::SetActiveCamera() const
{
UGameplayStatics::GetPlayerController(this->GetWorld(), 0)->SetViewTarget(this->GetOwner());
}

void URTSCamera::ConditionallyPerformEdgeScrolling() const
{
if (this->EnableEdgeScrolling)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Copyright 2022, Jesus Bracho, All Rights Reserved.


#include "RTSCameraBoundsVolume.h"

#include "Components/PrimitiveComponent.h"

ARTSCameraBoundsVolume::ARTSCameraBoundsVolume()
{
Expand All @@ -12,4 +11,4 @@ ARTSCameraBoundsVolume::ARTSCameraBoundsVolume()
{
PrimitiveComponent->SetCollisionProfileName(UCollisionProfile::NoCollision_ProfileName, false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"

class FOpenRTSCameraModule : public IModuleInterface
class FOpenRTSCameraRuntimeModule : public IModuleInterface
{
public:

/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
#include "GameFramework/SpringArmComponent.h"
#include "RTSCamera.generated.h"


UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class OPENRTSCAMERA_API URTSCamera : public UActorComponent
UCLASS(Blueprintable, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class OPENRTSCAMERARUNTIME_API URTSCamera : public UActorComponent
{
GENERATED_BODY()

Expand Down Expand Up @@ -49,7 +48,6 @@ class OPENRTSCAMERA_API URTSCamera : public UActorComponent
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "RTSCamera")
float RotateSpeed;


UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "RTSCamera")
bool EnableCameraLag;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "RTSCamera")
Expand Down Expand Up @@ -134,6 +132,7 @@ class OPENRTSCAMERA_API URTSCamera : public UActorComponent
void CheckForEnhancedInputComponent() const;
void BindInputMappingContext() const;
void BindInputActions();
void SetActiveCamera() const;

void ConditionallyPerformEdgeScrolling() const;
void EdgeScrollLeft() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@
#include "GameFramework/CameraBlockingVolume.h"
#include "RTSCameraBoundsVolume.generated.h"

/**
*
*/
UCLASS()
class OPENRTSCAMERA_API ARTSCameraBoundsVolume : public ACameraBlockingVolume
class OPENRTSCAMERARUNTIME_API ARTSCameraBoundsVolume : public ACameraBlockingVolume
{
GENERATED_BODY()

ARTSCameraBoundsVolume();
};

0 comments on commit 73275ef

Please sign in to comment.