diff --git a/Content/Blueprints/Enemy1.uasset b/Content/Blueprints/Enemy1.uasset new file mode 100644 index 0000000..2e3e99c --- /dev/null +++ b/Content/Blueprints/Enemy1.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ced17673541d57c0628d7b61428589e3ad3f77b3c808ce7b3508ca56add5dabf +size 30732 diff --git a/Content/Materials/wood.uasset b/Content/Materials/wood.uasset new file mode 100644 index 0000000..5843be9 --- /dev/null +++ b/Content/Materials/wood.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:143981c446e6c42dce27b22c059f5b6a5b4a27b3d7beca1a297b937762241e5a +size 9139 diff --git a/Content/Mesh/SM_Cruise_Ship.uasset b/Content/Mesh/SM_Cruise_Ship.uasset index 8bdd9c2..d01222b 100644 --- a/Content/Mesh/SM_Cruise_Ship.uasset +++ b/Content/Mesh/SM_Cruise_Ship.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81c8e4814958864250ae276cecd5614170d6db125e811d20cf91b2dccabac197 -size 35270 +oid sha256:7a9115b798538e6c9b8744a3cfba41b9983468ae02119d194e9cc3ffb3c639b0 +size 34246 diff --git a/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/0/WE/N7TQAW7EYBX1N3M24YRH1W.uasset b/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/0/WE/N7TQAW7EYBX1N3M24YRH1W.uasset index ae8c3ea..dc02af0 100644 --- a/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/0/WE/N7TQAW7EYBX1N3M24YRH1W.uasset +++ b/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/0/WE/N7TQAW7EYBX1N3M24YRH1W.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:614f4ec79e04899fdbee8af6edf835a6a752ae315cf195760000e86816424b2f -size 4402 +oid sha256:9d06987f6b95da77ef0eb30b4c795d6f0e48ae6fae0596db19a47d4b8fca061f +size 4433 diff --git a/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/3/GF/DSP61390DCUYCTAMIGPN19.uasset b/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/3/GF/DSP61390DCUYCTAMIGPN19.uasset index 4fdb974..6c90032 100644 --- a/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/3/GF/DSP61390DCUYCTAMIGPN19.uasset +++ b/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/3/GF/DSP61390DCUYCTAMIGPN19.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bb737f5163a0882b9a0ab8052e5534629a06d3be93aea32ba49b82a968d4a639 +oid sha256:0dd72a3c89669bdcb34207019aa1eacaa789c0d9e14e5c57428ec98fc9de9396 size 4508 diff --git a/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/8/HV/62WBH69GK0ZJ89EDPZVWVD.uasset b/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/8/HV/62WBH69GK0ZJ89EDPZVWVD.uasset new file mode 100644 index 0000000..57a474b --- /dev/null +++ b/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/8/HV/62WBH69GK0ZJ89EDPZVWVD.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:089b59591e109d38772227abc89d957ebe8ea9015c96abdfa1a2348d81fe552d +size 5528 diff --git a/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/D/DE/SWSI13675DVYIZ0N4NF7Y3.uasset b/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/D/DE/SWSI13675DVYIZ0N4NF7Y3.uasset index 7f8018a..04976e3 100644 --- a/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/D/DE/SWSI13675DVYIZ0N4NF7Y3.uasset +++ b/Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/D/DE/SWSI13675DVYIZ0N4NF7Y3.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:155efc55358d86b7b7017b683862030b83481f5dbb4551c9d759694bb112232b -size 4064 +oid sha256:51835807c64ed374265df6e5b89347e26ff7e87c369a277aaaadd5122ebffa63 +size 5045 diff --git a/Source/jumpingship/MoveComponent.cpp b/Source/jumpingship/MoveComponent.cpp new file mode 100644 index 0000000..64fb3c3 --- /dev/null +++ b/Source/jumpingship/MoveComponent.cpp @@ -0,0 +1,47 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "MoveComponent.h" + +// Sets default values for this component's properties +UMoveComponent::UMoveComponent() +{ + // 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 UMoveComponent::BeginPlay() +{ + Super::BeginPlay(); + + // Set start location + StartRelativeLocation = this->GetRelativeLocation(); + + //Compute normalized movement + MoveOffsetNorm = MoveOffset; + MoveOffsetNorm.Normalize(); + MaxDistance = MoveOffset.Length(); + //Check if ticking required + SetComponentTickEnabled(MoveEnable); +} + + +// Called every frame +void UMoveComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) +{ + Super::TickComponent(DeltaTime, TickType, ThisTickFunction); + //Set the current distance + if (MoveEnable) + { + CurDistance += DeltaTime * Speed * MoveDirection; + if (CurDistance >= MaxDistance || CurDistance <= 0.0f) { + MoveDirection *= -1; + } + } + // Compute and set current location + SetRelativeLocation(StartRelativeLocation + MoveOffsetNorm * CurDistance); +} \ No newline at end of file diff --git a/Source/jumpingship/MoveComponent.h b/Source/jumpingship/MoveComponent.h new file mode 100644 index 0000000..26bfd8b --- /dev/null +++ b/Source/jumpingship/MoveComponent.h @@ -0,0 +1,46 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Components/SceneComponent.h" +#include "MoveComponent.generated.h" + + +UCLASS(ClassGroup = (Actors), meta = (BlueprintSpawnableComponent)) +class JUMPINGSHIP_API UMoveComponent : public USceneComponent +{ + GENERATED_BODY() + +public: + // Sets default values for this component's properties + UMoveComponent(); + +protected: + // Called when the game starts + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; + + //Offset to move + UPROPERTY(EditAnywhere) + FVector MoveOffset; +private: + friend class FMoveComponentVisualizer; + + // Enables the movement of the component + UPROPERTY(EditAnywhere) + bool MoveEnable = true; + //Speed + UPROPERTY(EditAnywhere) + float Speed = 1.0f; + + //Computed locations + FVector StartRelativeLocation; + FVector MoveOffsetNorm; + float MaxDistance = 0.0f; + float CurDistance = 0.0f; + float MoveDirection = 1; +}; \ No newline at end of file