Compare commits
No commits in common. "6a6fd732928e328bd72398b0a9498db77bcc119c" and "f1d729c7e33a137140aa31219b366cbb8d5c94fc" have entirely different histories.
6a6fd73292
...
f1d729c7e3
BIN
Content/Blueprints/Enemy2.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Enemy2.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Passenger.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Passenger.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Materials/wood.uasset
(Stored with Git LFS)
BIN
Content/Materials/wood.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/MoveBlueprint.uasset
(Stored with Git LFS)
BIN
Content/MoveBlueprint.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/NewActorComponent.uasset
(Stored with Git LFS)
BIN
Content/NewActorComponent.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Passenger.uasset
(Stored with Git LFS)
BIN
Content/Passenger.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/0/WE/N7TQAW7EYBX1N3M24YRH1W.uasset
(Stored with Git LFS)
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/0/WE/N7TQAW7EYBX1N3M24YRH1W.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/3/GF/DSP61390DCUYCTAMIGPN19.uasset
(Stored with Git LFS)
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/3/GF/DSP61390DCUYCTAMIGPN19.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/3/NR/3PPF1JB1HIA5CBG5OZ4R7K.uasset
(Stored with Git LFS)
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/3/NR/3PPF1JB1HIA5CBG5OZ4R7K.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/4/XE/XZF4FG6J7P5ELB9G6BX7Z6.uasset
(Stored with Git LFS)
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/4/XE/XZF4FG6J7P5ELB9G6BX7Z6.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/5/9N/KEY1WNHPMBTRIPJOO74VKR.uasset
(Stored with Git LFS)
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/5/9N/KEY1WNHPMBTRIPJOO74VKR.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/D/DE/SWSI13675DVYIZ0N4NF7Y3.uasset
(Stored with Git LFS)
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/D/DE/SWSI13675DVYIZ0N4NF7Y3.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/F/0G/WVXTBQJV6M3CLRMZJ0OSZE.uasset
(Stored with Git LFS)
BIN
Content/__ExternalActors__/ThirdPerson/Maps/ThirdPersonMap/F/0G/WVXTBQJV6M3CLRMZJ0OSZE.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/testingActor.uasset
(Stored with Git LFS)
BIN
Content/testingActor.uasset
(Stored with Git LFS)
Binary file not shown.
@ -1,47 +0,0 @@
|
||||
// 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);
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
// 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;
|
||||
};
|
Loading…
Reference in New Issue
Block a user