From fc0c41c92eb0f668e618a19f3bfc318c232c693a Mon Sep 17 00:00:00 2001 From: Pascal Date: Fri, 23 Aug 2019 12:27:27 +0200 Subject: [PATCH 1/2] Resolves build errors for 4.18 and up --- .../ExtendingTheEditor.uproject | 24 +++++++++---------- .../DemoEditorExtensionsEditor.Build.cs | 2 +- .../DemoEditorExtensionsRuntime.Build.cs | 2 +- .../Source/ExtendingTheEditor.Target.cs | 17 +++---------- .../ExtendingTheEditor.Build.cs | 2 +- .../Source/ExtendingTheEditorEditor.Target.cs | 17 +++---------- 6 files changed, 21 insertions(+), 43 deletions(-) diff --git a/ExtendingTheEditor/ExtendingTheEditor.uproject b/ExtendingTheEditor/ExtendingTheEditor.uproject index 35f3b22..51c9912 100644 --- a/ExtendingTheEditor/ExtendingTheEditor.uproject +++ b/ExtendingTheEditor/ExtendingTheEditor.uproject @@ -1,13 +1,13 @@ -{ - "FileVersion": 3, - "EngineAssociation": "4.10", - "Category": "", - "Description": "", - "Modules": [ - { - "Name": "ExtendingTheEditor", - "Type": "Runtime", - "LoadingPhase": "Default" - } - ] +{ + "FileVersion": 3, + "EngineAssociation": "4.22", + "Category": "", + "Description": "", + "Modules": [ + { + "Name": "ExtendingTheEditor", + "Type": "Runtime", + "LoadingPhase": "Default" + } + ] } \ No newline at end of file diff --git a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/DemoEditorExtensionsEditor.Build.cs b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/DemoEditorExtensionsEditor.Build.cs index 600b04f..8c718b6 100644 --- a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/DemoEditorExtensionsEditor.Build.cs +++ b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/DemoEditorExtensionsEditor.Build.cs @@ -2,7 +2,7 @@ public class DemoEditorExtensionsEditor : ModuleRules { - public DemoEditorExtensionsEditor(TargetInfo Target) + public DemoEditorExtensionsEditor(ReadOnlyTargetRules Target) : base(Target) { PublicDependencyModuleNames.AddRange( new string[] { diff --git a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsRuntime/DemoEditorExtensionsRuntime.Build.cs b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsRuntime/DemoEditorExtensionsRuntime.Build.cs index 9c6e9c9..9d0a59b 100644 --- a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsRuntime/DemoEditorExtensionsRuntime.Build.cs +++ b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsRuntime/DemoEditorExtensionsRuntime.Build.cs @@ -2,7 +2,7 @@ public class DemoEditorExtensionsRuntime : ModuleRules { - public DemoEditorExtensionsRuntime(TargetInfo Target) + public DemoEditorExtensionsRuntime(ReadOnlyTargetRules Target) : base(Target) { PublicDependencyModuleNames.AddRange( new string[] { diff --git a/ExtendingTheEditor/Source/ExtendingTheEditor.Target.cs b/ExtendingTheEditor/Source/ExtendingTheEditor.Target.cs index 86f852c..78630e1 100644 --- a/ExtendingTheEditor/Source/ExtendingTheEditor.Target.cs +++ b/ExtendingTheEditor/Source/ExtendingTheEditor.Target.cs @@ -5,21 +5,10 @@ public class ExtendingTheEditorTarget : TargetRules { - public ExtendingTheEditorTarget(TargetInfo Target) + public ExtendingTheEditorTarget(TargetInfo Target) : base(Target) { Type = TargetType.Game; - } - - // - // TargetRules interface. - // - - public override void SetupBinaries( - TargetInfo Target, - ref List OutBuildBinaryConfigurations, - ref List OutExtraModuleNames - ) - { - OutExtraModuleNames.Add("ExtendingTheEditor"); + + ExtraModuleNames.AddRange( new string[] {"ExtendingTheEditor"} ); } } diff --git a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditor.Build.cs b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditor.Build.cs index fb80175..cb14ab2 100644 --- a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditor.Build.cs +++ b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditor.Build.cs @@ -4,7 +4,7 @@ public class ExtendingTheEditor : ModuleRules { - public ExtendingTheEditor(TargetInfo Target) + public ExtendingTheEditor(ReadOnlyTargetRules Target) : base(Target) { PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); } diff --git a/ExtendingTheEditor/Source/ExtendingTheEditorEditor.Target.cs b/ExtendingTheEditor/Source/ExtendingTheEditorEditor.Target.cs index 7ab04d9..f57a289 100644 --- a/ExtendingTheEditor/Source/ExtendingTheEditorEditor.Target.cs +++ b/ExtendingTheEditor/Source/ExtendingTheEditorEditor.Target.cs @@ -5,21 +5,10 @@ public class ExtendingTheEditorEditorTarget : TargetRules { - public ExtendingTheEditorEditorTarget(TargetInfo Target) + public ExtendingTheEditorEditorTarget(TargetInfo Target) : base(Target) { Type = TargetType.Editor; - } - - // - // TargetRules interface. - // - - public override void SetupBinaries( - TargetInfo Target, - ref List OutBuildBinaryConfigurations, - ref List OutExtraModuleNames - ) - { - OutExtraModuleNames.Add("ExtendingTheEditor"); + + ExtraModuleNames.AddRange( new string[] { "ExtendingTheEditorEditor" } ); } } From 05fe9d24fe9d231a8b881edd49f7f210f6306732 Mon Sep 17 00:00:00 2001 From: Pascal Date: Fri, 23 Aug 2019 16:19:50 +0200 Subject: [PATCH 2/2] Preparing voor building in 4.18 (and up?) --- .../DemoEditorExtensionsEditor.Build.cs | 6 ++- .../Private/BaseEditorTool.cpp | 3 +- .../Private/BaseEditorToolCustomization.cpp | 2 +- .../Private/DemoCommands.cpp | 2 +- .../Private/DemoStyle.cpp | 2 +- .../Private/MirrorTool.cpp | 2 +- .../DemoEditorExtensionsRuntime.Build.cs | 6 ++- .../ExtendingTheEditor.Build.cs | 6 ++- .../ExtendingTheEditor/ExtendingTheEditor.h | 3 +- .../ExtendingTheEditorCharacter.cpp | 36 ++++++++-------- .../ExtendingTheEditorCharacter.h | 4 +- .../ExtendingTheEditorGameMode.cpp | 3 +- .../ExtendingTheEditorHUD.cpp | 2 +- .../ExtendingTheEditorProjectile.cpp | 43 ------------------- .../ExtendingTheEditorProjectile.h | 31 ------------- .../Source/ExtendingTheEditorEditor.Target.cs | 2 +- 16 files changed, 43 insertions(+), 110 deletions(-) delete mode 100644 ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorProjectile.cpp delete mode 100644 ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorProjectile.h diff --git a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/DemoEditorExtensionsEditor.Build.cs b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/DemoEditorExtensionsEditor.Build.cs index 8c718b6..44aee2a 100644 --- a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/DemoEditorExtensionsEditor.Build.cs +++ b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/DemoEditorExtensionsEditor.Build.cs @@ -3,8 +3,10 @@ public class DemoEditorExtensionsEditor : ModuleRules { public DemoEditorExtensionsEditor(ReadOnlyTargetRules Target) : base(Target) - { - PublicDependencyModuleNames.AddRange( + { + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", diff --git a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/BaseEditorTool.cpp b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/BaseEditorTool.cpp index 0b95e95..a4d21b8 100644 --- a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/BaseEditorTool.cpp +++ b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/BaseEditorTool.cpp @@ -1,2 +1,3 @@ -#include "DemoEditorExtensionsEditorPrivatePCH.h" #include "BaseEditorTool.h" +#include "DemoEditorExtensionsEditorPrivatePCH.h" + diff --git a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/BaseEditorToolCustomization.cpp b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/BaseEditorToolCustomization.cpp index 2680ddf..0884d0e 100644 --- a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/BaseEditorToolCustomization.cpp +++ b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/BaseEditorToolCustomization.cpp @@ -1,5 +1,5 @@ -#include "DemoEditorExtensionsEditorPrivatePCH.h" #include "BaseEditorToolCustomization.h" +#include "DemoEditorExtensionsEditorPrivatePCH.h" #include "PropertyEditing.h" #define LOCTEXT_NAMESPACE "BaseToolEditor" diff --git a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/DemoCommands.cpp b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/DemoCommands.cpp index 7a4eded..a2bd465 100644 --- a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/DemoCommands.cpp +++ b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/DemoCommands.cpp @@ -1,5 +1,5 @@ -#include "DemoEditorExtensionsEditorPrivatePCH.h" #include "DemoCommands.h" +#include "DemoEditorExtensionsEditorPrivatePCH.h" #define LOCTEXT_NAMESPACE "DemoTools" diff --git a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/DemoStyle.cpp b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/DemoStyle.cpp index 54f04a5..5364c84 100644 --- a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/DemoStyle.cpp +++ b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/DemoStyle.cpp @@ -1,5 +1,5 @@ -#include "DemoEditorExtensionsEditorPrivatePCH.h" #include "DemoStyle.h" +#include "DemoEditorExtensionsEditorPrivatePCH.h" void FDemoStyle::Initialize() { diff --git a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/MirrorTool.cpp b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/MirrorTool.cpp index 8cb0903..c145fec 100644 --- a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/MirrorTool.cpp +++ b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsEditor/Private/MirrorTool.cpp @@ -1,5 +1,5 @@ -#include "DemoEditorExtensionsEditorPrivatePCH.h" #include "MirrorTool.h" +#include "DemoEditorExtensionsEditorPrivatePCH.h" #include "ScopedTransaction.h" #define LOCTEXT_NAMESPACE "DemoTools" diff --git a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsRuntime/DemoEditorExtensionsRuntime.Build.cs b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsRuntime/DemoEditorExtensionsRuntime.Build.cs index 9d0a59b..eaa3e86 100644 --- a/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsRuntime/DemoEditorExtensionsRuntime.Build.cs +++ b/ExtendingTheEditor/Plugins/DemoEditorExtensions/Source/DemoEditorExtensionsRuntime/DemoEditorExtensionsRuntime.Build.cs @@ -3,8 +3,10 @@ public class DemoEditorExtensionsRuntime : ModuleRules { public DemoEditorExtensionsRuntime(ReadOnlyTargetRules Target) : base(Target) - { - PublicDependencyModuleNames.AddRange( + { + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", diff --git a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditor.Build.cs b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditor.Build.cs index cb14ab2..89e6ded 100644 --- a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditor.Build.cs +++ b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditor.Build.cs @@ -5,7 +5,9 @@ public class ExtendingTheEditor : ModuleRules { public ExtendingTheEditor(ReadOnlyTargetRules Target) : base(Target) - { - PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); + { + PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; + + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); } } diff --git a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditor.h b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditor.h index dbd7e1f..1869375 100644 --- a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditor.h +++ b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditor.h @@ -3,7 +3,8 @@ #ifndef __EXTENDINGTHEEDITOR_H__ #define __EXTENDINGTHEEDITOR_H__ -#include "EngineMinimal.h" +#include "CoreMinimal.h" +#include "Engine.h" #endif diff --git a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorCharacter.cpp b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorCharacter.cpp index b76daa1..441c05f 100644 --- a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorCharacter.cpp +++ b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorCharacter.cpp @@ -1,8 +1,8 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. -#include "ExtendingTheEditor.h" #include "ExtendingTheEditorCharacter.h" -#include "ExtendingTheEditorProjectile.h" +#include "ExtendingTheEditor.h" +//#include "ExtendingTheEditorProjectile.h" #include "Animation/AnimInstance.h" #include "GameFramework/InputSettings.h" @@ -22,14 +22,14 @@ AExtendingTheEditorCharacter::AExtendingTheEditorCharacter() // Create a CameraComponent FirstPersonCameraComponent = CreateDefaultSubobject(TEXT("FirstPersonCamera")); - FirstPersonCameraComponent->AttachParent = GetCapsuleComponent(); + FirstPersonCameraComponent->AttachToComponent( GetCapsuleComponent(), FAttachmentTransformRules::KeepWorldTransform); FirstPersonCameraComponent->RelativeLocation = FVector(0, 0, 64.f); // Position the camera FirstPersonCameraComponent->bUsePawnControlRotation = true; // Create a mesh component that will be used when being viewed from a '1st person' view (when controlling this pawn) Mesh1P = CreateDefaultSubobject(TEXT("CharacterMesh1P")); Mesh1P->SetOnlyOwnerSee(true); - Mesh1P->AttachParent = FirstPersonCameraComponent; + Mesh1P->AttachToComponent( FirstPersonCameraComponent, FAttachmentTransformRules::KeepWorldTransform); Mesh1P->bCastDynamicShadow = false; Mesh1P->CastShadow = false; @@ -38,7 +38,7 @@ AExtendingTheEditorCharacter::AExtendingTheEditorCharacter() FP_Gun->SetOnlyOwnerSee(true); // only the owning player will see this mesh FP_Gun->bCastDynamicShadow = false; FP_Gun->CastShadow = false; - FP_Gun->AttachTo(Mesh1P, TEXT("GripPoint"), EAttachLocation::SnapToTargetIncludingScale, true); + FP_Gun->AttachToComponent(Mesh1P, FAttachmentTransformRules::KeepWorldTransform); // Default offset from the character location for projectiles to spawn @@ -80,19 +80,19 @@ void AExtendingTheEditorCharacter::SetupPlayerInputComponent(class UInputCompone void AExtendingTheEditorCharacter::OnFire() { // try and fire a projectile - if (ProjectileClass != NULL) - { - const FRotator SpawnRotation = GetControlRotation(); - // MuzzleOffset is in camera space, so transform it to world space before offsetting from the character location to find the final muzzle position - const FVector SpawnLocation = GetActorLocation() + SpawnRotation.RotateVector(GunOffset); - - UWorld* const World = GetWorld(); - if (World != NULL) - { - // spawn the projectile at the muzzle - World->SpawnActor(ProjectileClass, SpawnLocation, SpawnRotation); - } - } +// if (ProjectileClass != NULL) +// { +// const FRotator SpawnRotation = GetControlRotation(); +// // MuzzleOffset is in camera space, so transform it to world space before offsetting from the character location to find the final muzzle position +// const FVector SpawnLocation = GetActorLocation() + SpawnRotation.RotateVector(GunOffset); +// +// UWorld* const World = GetWorld(); +// if (World != NULL) +// { +// // spawn the projectile at the muzzle +// World->SpawnActor(ProjectileClass, SpawnLocation, SpawnRotation); +// } +// } // try and play the sound if specified if (FireSound != NULL) diff --git a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorCharacter.h b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorCharacter.h index 691ec4c..06f5f2b 100644 --- a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorCharacter.h +++ b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorCharacter.h @@ -37,8 +37,8 @@ class AExtendingTheEditorCharacter : public ACharacter FVector GunOffset; /** Projectile class to spawn */ - UPROPERTY(EditDefaultsOnly, Category=Projectile) - TSubclassOf ProjectileClass; +// UPROPERTY(EditDefaultsOnly, Category=Projectile) +// TSubclassOf ProjectileClass; /** Sound to play each time we fire */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Gameplay) diff --git a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorGameMode.cpp b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorGameMode.cpp index 78102a8..659ecad 100644 --- a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorGameMode.cpp +++ b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorGameMode.cpp @@ -1,9 +1,8 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. -#include "ExtendingTheEditor.h" #include "ExtendingTheEditorGameMode.h" +#include "ExtendingTheEditor.h" #include "ExtendingTheEditorHUD.h" -#include "ExtendingTheEditorCharacter.h" AExtendingTheEditorGameMode::AExtendingTheEditorGameMode() : Super() diff --git a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorHUD.cpp b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorHUD.cpp index 89a5d5c..e6abb72 100644 --- a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorHUD.cpp +++ b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorHUD.cpp @@ -1,7 +1,7 @@ // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. -#include "ExtendingTheEditor.h" #include "ExtendingTheEditorHUD.h" +#include "ExtendingTheEditor.h" #include "Engine/Canvas.h" #include "TextureResource.h" #include "CanvasItem.h" diff --git a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorProjectile.cpp b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorProjectile.cpp deleted file mode 100644 index 97dd288..0000000 --- a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorProjectile.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. - -#include "ExtendingTheEditor.h" -#include "ExtendingTheEditorProjectile.h" -#include "GameFramework/ProjectileMovementComponent.h" - -AExtendingTheEditorProjectile::AExtendingTheEditorProjectile() -{ - // Use a sphere as a simple collision representation - CollisionComp = CreateDefaultSubobject(TEXT("SphereComp")); - CollisionComp->InitSphereRadius(5.0f); - CollisionComp->BodyInstance.SetCollisionProfileName("Projectile"); - CollisionComp->OnComponentHit.AddDynamic(this, &AExtendingTheEditorProjectile::OnHit); // set up a notification for when this component hits something blocking - - // Players can't walk on it - CollisionComp->SetWalkableSlopeOverride(FWalkableSlopeOverride(WalkableSlope_Unwalkable, 0.f)); - CollisionComp->CanCharacterStepUpOn = ECB_No; - - // Set as root component - RootComponent = CollisionComp; - - // Use a ProjectileMovementComponent to govern this projectile's movement - ProjectileMovement = CreateDefaultSubobject(TEXT("ProjectileComp")); - ProjectileMovement->UpdatedComponent = CollisionComp; - ProjectileMovement->InitialSpeed = 3000.f; - ProjectileMovement->MaxSpeed = 3000.f; - ProjectileMovement->bRotationFollowsVelocity = true; - ProjectileMovement->bShouldBounce = true; - - // Die after 3 seconds by default - InitialLifeSpan = 3.0f; -} - -void AExtendingTheEditorProjectile::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) -{ - // Only add impulse and destroy projectile if we hit a physics - if ((OtherActor != NULL) && (OtherActor != this) && (OtherComp != NULL) && OtherComp->IsSimulatingPhysics()) - { - OtherComp->AddImpulseAtLocation(GetVelocity() * 100.0f, GetActorLocation()); - - Destroy(); - } -} \ No newline at end of file diff --git a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorProjectile.h b/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorProjectile.h deleted file mode 100644 index 7feee5a..0000000 --- a/ExtendingTheEditor/Source/ExtendingTheEditor/ExtendingTheEditorProjectile.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. -#pragma once -#include "GameFramework/Actor.h" -#include "ExtendingTheEditorProjectile.generated.h" - -UCLASS(config=Game) -class AExtendingTheEditorProjectile : public AActor -{ - GENERATED_BODY() - - /** Sphere collision component */ - UPROPERTY(VisibleDefaultsOnly, Category=Projectile) - class USphereComponent* CollisionComp; - - /** Projectile movement component */ - UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Movement, meta = (AllowPrivateAccess = "true")) - class UProjectileMovementComponent* ProjectileMovement; - -public: - AExtendingTheEditorProjectile(); - - /** called when projectile hits something */ - UFUNCTION() - void OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit); - - /** Returns CollisionComp subobject **/ - FORCEINLINE class USphereComponent* GetCollisionComp() const { return CollisionComp; } - /** Returns ProjectileMovement subobject **/ - FORCEINLINE class UProjectileMovementComponent* GetProjectileMovement() const { return ProjectileMovement; } -}; - diff --git a/ExtendingTheEditor/Source/ExtendingTheEditorEditor.Target.cs b/ExtendingTheEditor/Source/ExtendingTheEditorEditor.Target.cs index f57a289..2544dc7 100644 --- a/ExtendingTheEditor/Source/ExtendingTheEditorEditor.Target.cs +++ b/ExtendingTheEditor/Source/ExtendingTheEditorEditor.Target.cs @@ -9,6 +9,6 @@ public ExtendingTheEditorEditorTarget(TargetInfo Target) : base(Target) { Type = TargetType.Editor; - ExtraModuleNames.AddRange( new string[] { "ExtendingTheEditorEditor" } ); + ExtraModuleNames.AddRange( new string[] { "ExtendingTheEditor" } ); } }