Merge branch 'DA-Test' of https://git.tlimon.fr/ICAN_4JV/LegumeMix into DA-Test
This commit is contained in:
commit
3729c194f7
@ -131,9 +131,11 @@ ManualIPAddress=
|
|||||||
+Profiles=(Name="Ragdoll",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="PhysicsBody",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore),(Channel="Bullet",Response=ECR_Ignore)),HelpMessage="Simulating Skeletal Mesh Component. All other channels will be set to default.")
|
+Profiles=(Name="Ragdoll",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="PhysicsBody",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore),(Channel="Bullet",Response=ECR_Ignore)),HelpMessage="Simulating Skeletal Mesh Component. All other channels will be set to default.")
|
||||||
+Profiles=(Name="Vehicle",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="Vehicle",CustomResponses=,HelpMessage="Vehicle object that blocks Vehicle, WorldStatic, and WorldDynamic. All other channels will be set to default.")
|
+Profiles=(Name="Vehicle",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="Vehicle",CustomResponses=,HelpMessage="Vehicle object that blocks Vehicle, WorldStatic, and WorldDynamic. All other channels will be set to default.")
|
||||||
+Profiles=(Name="UI",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap),(Channel="Bullet",Response=ECR_Ignore)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ")
|
+Profiles=(Name="UI",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap),(Channel="Bullet",Response=ECR_Ignore)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ")
|
||||||
|
+Profiles=(Name="Drop",CollisionEnabled=QueryAndPhysics,bCanModify=True,ObjectTypeName="Drop",CustomResponses=((Channel="WorldStatic",Response=ECR_Ignore),(Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore),(Channel="Camera",Response=ECR_Ignore),(Channel="PhysicsBody",Response=ECR_Ignore),(Channel="Vehicle",Response=ECR_Ignore),(Channel="Destructible",Response=ECR_Ignore),(Channel="Bullet",Response=ECR_Ignore),(Channel="Enemy",Response=ECR_Ignore),(Channel="Drop",Response=ECR_Ignore)),HelpMessage="Needs description")
|
||||||
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Block,bTraceType=True,bStaticObject=False,Name="Bullet")
|
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Block,bTraceType=True,bStaticObject=False,Name="Bullet")
|
||||||
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel2,DefaultResponse=ECR_Block,bTraceType=True,bStaticObject=False,Name="Enemy")
|
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel2,DefaultResponse=ECR_Block,bTraceType=True,bStaticObject=False,Name="Enemy")
|
||||||
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel3,DefaultResponse=ECR_Ignore,bTraceType=False,bStaticObject=False,Name="Projectile")
|
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel3,DefaultResponse=ECR_Ignore,bTraceType=False,bStaticObject=False,Name="Projectile")
|
||||||
|
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel4,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="Drop")
|
||||||
+EditProfiles=(Name="NoCollision",CustomResponses=((Channel="Bullet",Response=ECR_Ignore)))
|
+EditProfiles=(Name="NoCollision",CustomResponses=((Channel="Bullet",Response=ECR_Ignore)))
|
||||||
+EditProfiles=(Name="OverlapAll",CustomResponses=((Channel="Bullet",Response=ECR_Overlap)))
|
+EditProfiles=(Name="OverlapAll",CustomResponses=((Channel="Bullet",Response=ECR_Overlap)))
|
||||||
+EditProfiles=(Name="CharacterMesh",CustomResponses=((Channel="Bullet",Response=ECR_Ignore)))
|
+EditProfiles=(Name="CharacterMesh",CustomResponses=((Channel="Bullet",Response=ECR_Ignore)))
|
||||||
|
BIN
Content/FMOD/Desktop/Master.bank
(Stored with Git LFS)
BIN
Content/FMOD/Desktop/Master.bank
(Stored with Git LFS)
Binary file not shown.
BIN
Content/FMOD/Desktop/Master.strings.bank
(Stored with Git LFS)
BIN
Content/FMOD/Desktop/Master.strings.bank
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Drops/BP_AmmoSpawner.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Legumix/Drops/BP_AmmoSpawner.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Legumix/Drops/BP_DropRevolver.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Drops/BP_DropRevolver.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Drops/BP_DropShotgun.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Drops/BP_DropShotgun.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Drops/BP_HealthPack.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Drops/BP_HealthPack.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/E_EnemyState.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Legumix/Ennemy/E_EnemyState.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Legumix/Ennemy/MeleeEnemy/AI/BB_MeleeEnemy.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/MeleeEnemy/AI/BB_MeleeEnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/MeleeEnemy/AI/BT_MeleeEnemy.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/MeleeEnemy/AI/BT_MeleeEnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/MeleeEnemy/BP_MeleeEnemy.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/MeleeEnemy/BP_MeleeEnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/RangeEnemy/AI/BB_RangeEnnemy.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/RangeEnemy/AI/BB_RangeEnnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/RangeEnemy/AI/BT_RangeEnnemy.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/RangeEnemy/AI/BT_RangeEnnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/RangeEnemy/AI/Task/BTTask_RangeAttack.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/RangeEnemy/AI/Task/BTTask_RangeAttack.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/RangeEnemy/AIC_DistantEnnemy.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/RangeEnemy/AIC_DistantEnnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Levels/LVL_00.umap
(Stored with Git LFS)
BIN
Content/Legumix/Levels/LVL_00.umap
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Levels/LVL_TEST_003.umap
(Stored with Git LFS)
BIN
Content/Legumix/Levels/LVL_TEST_003.umap
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Player/BP_GrabComponent.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Legumix/Player/BP_GrabComponent.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Legumix/Player/BP_Play.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/BP_Play.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Player/BP_PlayerController.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/BP_PlayerController.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Player/C_GrabMovement.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Legumix/Player/C_GrabMovement.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Legumix/Spawner/DT_WavePreset.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Spawner/DT_WavePreset.uasset
(Stored with Git LFS)
Binary file not shown.
@ -3,8 +3,20 @@
|
|||||||
|
|
||||||
#include "Ammo/LMAmmoPack.h"
|
#include "Ammo/LMAmmoPack.h"
|
||||||
|
|
||||||
|
#include "Player/LMPlayer.h"
|
||||||
|
#include "Weapon/LMWeaponManager.h"
|
||||||
|
|
||||||
|
|
||||||
ALMAmmoPack::ALMAmmoPack()
|
ALMAmmoPack::ALMAmmoPack()
|
||||||
{
|
{
|
||||||
PrimaryActorTick.bCanEverTick = false;
|
PrimaryActorTick.bCanEverTick = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ALMAmmoPack::ConsumePack(ALMPlayer* Player)
|
||||||
|
{
|
||||||
|
Super::ConsumePack(Player);
|
||||||
|
|
||||||
|
Player->AddAmmo(AmmoType, AmmoCount);
|
||||||
|
OnPackConsumed();
|
||||||
|
Despawn();
|
||||||
|
}
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
ALMEnemy::ALMEnemy()
|
ALMEnemy::ALMEnemy()
|
||||||
{
|
{
|
||||||
PrimaryActorTick.bCanEverTick = true;
|
PrimaryActorTick.bCanEverTick = true;
|
||||||
EnemyState = EEnemyState::EES_Chasing;
|
|
||||||
AttackingRadius = 100.f;
|
AttackingRadius = 100.f;
|
||||||
AttackingDamage = 0.f;
|
AttackingDamage = 0.f;
|
||||||
}
|
}
|
||||||
@ -22,11 +21,6 @@ void ALMEnemy::Attack(const APawn* TargetedPawn)
|
|||||||
GEngine->AddOnScreenDebugMessage(1, 2.f, FColor::Cyan, Debug);
|
GEngine->AddOnScreenDebugMessage(1, 2.f, FColor::Cyan, Debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
double ALMEnemy::GetDistanceToTarget(const AActor* TargetedActor)
|
|
||||||
{
|
|
||||||
return (TargetedActor->GetActorLocation() - GetActorLocation()).Length();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ALMEnemy::Tick(float DeltaTime)
|
void ALMEnemy::Tick(float DeltaTime)
|
||||||
{
|
{
|
||||||
Super::Tick(DeltaTime);
|
Super::Tick(DeltaTime);
|
||||||
|
@ -3,9 +3,21 @@
|
|||||||
|
|
||||||
#include "LMHealthPack.h"
|
#include "LMHealthPack.h"
|
||||||
|
|
||||||
|
#include "Player/LMHealthComponent.h"
|
||||||
|
#include "Player/LMPlayer.h"
|
||||||
|
|
||||||
|
|
||||||
ALMHealthPack::ALMHealthPack()
|
ALMHealthPack::ALMHealthPack()
|
||||||
{
|
{
|
||||||
PrimaryActorTick.bCanEverTick = false;
|
PrimaryActorTick.bCanEverTick = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ALMHealthPack::ConsumePack(ALMPlayer* Player)
|
||||||
|
{
|
||||||
|
Super::ConsumePack(Player);
|
||||||
|
|
||||||
|
Player->GetHealthComponent()->AddHealth(HealthGain);
|
||||||
|
OnPackConsumed();
|
||||||
|
Despawn();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -3,20 +3,63 @@
|
|||||||
|
|
||||||
#include "LMItemDrop.h"
|
#include "LMItemDrop.h"
|
||||||
|
|
||||||
|
#include "Kismet/KismetMathLibrary.h"
|
||||||
|
|
||||||
|
|
||||||
ALMItemDrop::ALMItemDrop()
|
ALMItemDrop::ALMItemDrop()
|
||||||
{
|
{
|
||||||
PrimaryActorTick.bCanEverTick = true;
|
PrimaryActorTick.bCanEverTick = true;
|
||||||
|
Root = CreateDefaultSubobject<USceneComponent>("Root");
|
||||||
|
RootComponent = Root;
|
||||||
|
|
||||||
StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>("MeshComponent");
|
StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>("MeshComponent");
|
||||||
RootComponent = StaticMeshComponent;
|
StaticMeshComponent->SetupAttachment(RootComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ALMItemDrop::BeginPlay()
|
void ALMItemDrop::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
SpawnLocation = GetActorLocation();
|
||||||
GetWorldTimerManager().SetTimer(DespawnHandle, this, &ALMItemDrop::Despawn, TimeBeforeDespawn);
|
GetWorldTimerManager().SetTimer(DespawnHandle, this, &ALMItemDrop::Despawn, TimeBeforeDespawn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ALMItemDrop::SetAttractor(AActor* Target)
|
||||||
|
{
|
||||||
|
Attractor = Target;
|
||||||
|
GetWorldTimerManager().SetTimer(MoveHandle, this, &ALMItemDrop::DoMovingTowardsTarget, MoveRate, true);
|
||||||
|
GetWorldTimerManager().ClearTimer(DespawnHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALMItemDrop::DoMovingTowardsTarget()
|
||||||
|
{
|
||||||
|
if (MoveTime >= MoveDuration)
|
||||||
|
{
|
||||||
|
GetWorldTimerManager().ClearTimer(MoveHandle);
|
||||||
|
SetActorLocation(Attractor->GetActorLocation());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FVector Position = Attractor->GetActorLocation();
|
||||||
|
|
||||||
|
const float Duration = MoveTime / MoveDuration;
|
||||||
|
|
||||||
|
FString text = FString::Printf(TEXT("Time : %f / %f = %f"), MoveTime, MoveDuration, Duration);
|
||||||
|
GEngine->AddOnScreenDebugMessage(-15, 1.f, FColor::Red, text);
|
||||||
|
const float CurvePosition = PositionAtTime->GetFloatValue(Duration);
|
||||||
|
const FVector NewPosition = UKismetMathLibrary::VLerp(SpawnLocation, Position, CurvePosition);
|
||||||
|
|
||||||
|
MoveTime += MoveRate;
|
||||||
|
SetActorLocation(NewPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALMItemDrop::ConsumePack(ALMPlayer* Player)
|
||||||
|
{
|
||||||
|
if (MoveHandle.IsValid())
|
||||||
|
{
|
||||||
|
GetWorldTimerManager().ClearTimer(MoveHandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ALMItemDrop::Despawn()
|
void ALMItemDrop::Despawn()
|
||||||
{
|
{
|
||||||
GetWorldTimerManager().ClearTimer(DespawnHandle);
|
GetWorldTimerManager().ClearTimer(DespawnHandle);
|
||||||
|
66
Source/LegumeMix/Private/Player/LMGrabRange.cpp
Normal file
66
Source/LegumeMix/Private/Player/LMGrabRange.cpp
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "LMGrabRange.h"
|
||||||
|
|
||||||
|
#include "LMItemDrop.h"
|
||||||
|
#include "Player/LMPlayer.h"
|
||||||
|
|
||||||
|
|
||||||
|
ULMGrabRange::ULMGrabRange()
|
||||||
|
{
|
||||||
|
PrimaryComponentTick.bCanEverTick = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ULMGrabRange::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||||
|
{
|
||||||
|
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||||
|
|
||||||
|
if (!bIsEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (int i = Drops.Num() - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
ALMItemDrop* Item = Drops[i];
|
||||||
|
|
||||||
|
const FVector ItemPosition = Item->GetActorLocation();
|
||||||
|
const FVector Position = GetComponentLocation();
|
||||||
|
|
||||||
|
const float DistanceLeft = FVector::Dist(ItemPosition, Position);
|
||||||
|
FString text = FString::Printf(TEXT("Item %s at distance %f"), *Item->GetName(), DistanceLeft);
|
||||||
|
GEngine->AddOnScreenDebugMessage(i, 1.f, FColor::Cyan, text);
|
||||||
|
|
||||||
|
if (DistanceLeft <= RangeToGrab)
|
||||||
|
{
|
||||||
|
Item->ConsumePack(Player);
|
||||||
|
Drops.Remove(Item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ULMGrabRange::OnDropOverlapped(ALMItemDrop* ItemDrop)
|
||||||
|
{
|
||||||
|
Drops.AddUnique(ItemDrop);
|
||||||
|
ItemDrop->SetAttractor(Player);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ULMGrabRange::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
Player = CastChecked<ALMPlayer>(GetOwner());
|
||||||
|
OnComponentBeginOverlap.AddUniqueDynamic(this, &ULMGrabRange::OnComponentOverlap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ULMGrabRange::OnComponentOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
|
||||||
|
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
|
||||||
|
{
|
||||||
|
if (!bIsEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ALMItemDrop* ItemDrop = Cast<ALMItemDrop>(OtherActor))
|
||||||
|
{
|
||||||
|
OnDropOverlapped(ItemDrop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
45
Source/LegumeMix/Private/Player/LMGrabRange.h
Normal file
45
Source/LegumeMix/Private/Player/LMGrabRange.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "Components/SphereComponent.h"
|
||||||
|
#include "LMGrabRange.generated.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ALMPlayer;
|
||||||
|
class ALMItemDrop;
|
||||||
|
|
||||||
|
UCLASS(Blueprintable, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
|
||||||
|
class LEGUMEMIX_API ULMGrabRange : public USphereComponent
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
private:
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
||||||
|
bool bIsEnabled = true;
|
||||||
|
|
||||||
|
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category=Legumix, meta=(AllowPrivateAccess=true))
|
||||||
|
TArray<ALMItemDrop*> Drops;
|
||||||
|
|
||||||
|
/** The range at which the drop is consumed. */
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix, meta=(AllowPrivateAccess=true, ClampMin=0.1f))
|
||||||
|
float RangeToGrab = 10.f;
|
||||||
|
|
||||||
|
TObjectPtr<ALMPlayer> Player;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ULMGrabRange();
|
||||||
|
UFUNCTION(BlueprintCallable, Category=Legumix)
|
||||||
|
void OnDropOverlapped(ALMItemDrop* ItemDrop);
|
||||||
|
|
||||||
|
virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
UFUNCTION()
|
||||||
|
void OnComponentOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp,
|
||||||
|
int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
|
||||||
|
};
|
@ -116,6 +116,14 @@ bool ALMPlayer::CanJumpInternal_Implementation() const
|
|||||||
return JumpIsAllowedInternal();
|
return JumpIsAllowedInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ALMPlayer::AddAmmo(const EAmmoType Ammo, const int AmmoCount)
|
||||||
|
{
|
||||||
|
if (GetWeaponManager()->AddAmmoType(Ammo, AmmoCount))
|
||||||
|
{
|
||||||
|
OnAmmoPickup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ALMPlayer::SetWeaponManager(ULMWeaponManager* Manager)
|
void ALMPlayer::SetWeaponManager(ULMWeaponManager* Manager)
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Warning, TEXT("Set weapon manager"))
|
UE_LOG(LogTemp, Warning, TEXT("Set weapon manager"))
|
||||||
|
@ -35,6 +35,7 @@ void ALMPlayerController::SetupInputComponent()
|
|||||||
Input->BindAction(FireAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Fire);
|
Input->BindAction(FireAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Fire);
|
||||||
Input->BindAction(ReloadAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Reload);
|
Input->BindAction(ReloadAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Reload);
|
||||||
Input->BindAction(ScrollAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Scroll);
|
Input->BindAction(ScrollAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Scroll);
|
||||||
|
Input->BindAction(ScrollAction, ETriggerEvent::Canceled, this, &ALMPlayerController::ScrollEnded);
|
||||||
Input->BindAction(PauseAction, ETriggerEvent::Triggered, this, &ALMPlayerController::TogglePause);
|
Input->BindAction(PauseAction, ETriggerEvent::Triggered, this, &ALMPlayerController::TogglePause);
|
||||||
Input->BindAction(SlideAction, ETriggerEvent::Started, this, &ALMPlayerController::SlideInput);
|
Input->BindAction(SlideAction, ETriggerEvent::Started, this, &ALMPlayerController::SlideInput);
|
||||||
Input->BindAction(SlideAction, ETriggerEvent::Completed, this, &ALMPlayerController::SlideCancel);
|
Input->BindAction(SlideAction, ETriggerEvent::Completed, this, &ALMPlayerController::SlideCancel);
|
||||||
@ -73,8 +74,19 @@ void ALMPlayerController::Reload(const FInputActionValue& InputValue)
|
|||||||
|
|
||||||
void ALMPlayerController::Scroll(const FInputActionValue& InputValue)
|
void ALMPlayerController::Scroll(const FInputActionValue& InputValue)
|
||||||
{
|
{
|
||||||
|
if (bIsScrolling)
|
||||||
|
return;
|
||||||
|
|
||||||
const float ScrollAmount = InputValue.Get<float>();
|
const float ScrollAmount = InputValue.Get<float>();
|
||||||
LegumixPlayer->GetWeaponManager()->SwitchWeapon(ScrollAmount);
|
LegumixPlayer->GetWeaponManager()->SwitchWeapon(ScrollAmount);
|
||||||
|
bIsScrolling = true;
|
||||||
|
GetWorldTimerManager().SetTimer(ScrollTimer, this, &ALMPlayerController::ScrollEnded, SwitchWeaponDelay, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALMPlayerController::ScrollEnded()
|
||||||
|
{
|
||||||
|
GetWorldTimerManager().ClearTimer(ScrollTimer);
|
||||||
|
bIsScrolling = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ALMPlayerController::PauseInput(const FInputActionValue& InputValue)
|
void ALMPlayerController::PauseInput(const FInputActionValue& InputValue)
|
||||||
|
@ -21,4 +21,6 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ALMAmmoPack();
|
ALMAmmoPack();
|
||||||
|
|
||||||
|
virtual void ConsumePack(ALMPlayer* Player) override;
|
||||||
};
|
};
|
||||||
|
@ -6,13 +6,6 @@
|
|||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
#include "LMEnemy.generated.h"
|
#include "LMEnemy.generated.h"
|
||||||
|
|
||||||
UENUM(BlueprintType)
|
|
||||||
enum class EEnemyState : uint8
|
|
||||||
{
|
|
||||||
EES_Chasing UMETA(DisplayName = "Chasing"),
|
|
||||||
EES_Attacking UMETA(DisplayName = "Attacking")
|
|
||||||
};
|
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class LEGUMEMIX_API ALMEnemy : public ACharacter
|
class LEGUMEMIX_API ALMEnemy : public ACharacter
|
||||||
{
|
{
|
||||||
@ -31,23 +24,12 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category = "Legumix")
|
|
||||||
EEnemyState EnemyState;
|
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category = "Legumix")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category = "Legumix")
|
||||||
double AttackingRadius;
|
double AttackingRadius;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category = "Legumix")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category = "Legumix")
|
||||||
float AttackingDamage;
|
float AttackingDamage;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the distance between the enemy and a target.
|
|
||||||
* @param TargetedActor
|
|
||||||
* @returns the distance
|
|
||||||
*/
|
|
||||||
UFUNCTION(BlueprintCallable, Category="Legumix", meta=(ReturnDisplayName="Distance", DefaultToSelf="TargetedActor"))
|
|
||||||
double GetDistanceToTarget(const AActor* TargetedActor);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs an attack on the targeted pawn
|
* Performs an attack on the targeted pawn
|
||||||
* @param TargetedPawn
|
* @param TargetedPawn
|
||||||
|
@ -17,4 +17,6 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ALMHealthPack();
|
ALMHealthPack();
|
||||||
|
|
||||||
|
virtual void ConsumePack(ALMPlayer* Player) override;
|
||||||
};
|
};
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "GameFramework/Actor.h"
|
#include "GameFramework/Actor.h"
|
||||||
#include "LMItemDrop.generated.h"
|
#include "LMItemDrop.generated.h"
|
||||||
|
|
||||||
|
class ALMPlayer;
|
||||||
class ULMDropData;
|
class ULMDropData;
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
@ -16,17 +17,50 @@ class LEGUMEMIX_API ALMItemDrop : public AActor
|
|||||||
protected:
|
protected:
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix)
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix)
|
||||||
float TimeBeforeDespawn = 30.f;
|
float TimeBeforeDespawn = 30.f;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix)
|
||||||
|
float MoveRate = 0.1f;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix)
|
||||||
|
float MoveDuration = 1.f;
|
||||||
|
|
||||||
|
/** Distance curve from 0-1 to the player. */
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix, meta=(AllowPrivateAccess=true))
|
||||||
|
TObjectPtr<UCurveFloat> PositionAtTime;
|
||||||
|
|
||||||
|
FTimerHandle DespawnHandle;
|
||||||
|
FTimerHandle MoveHandle;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
|
||||||
|
TObjectPtr<USceneComponent> Root;
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
|
||||||
TObjectPtr<UStaticMeshComponent> StaticMeshComponent;
|
TObjectPtr<UStaticMeshComponent> StaticMeshComponent;
|
||||||
|
|
||||||
FTimerHandle DespawnHandle;
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true))
|
||||||
|
FVector SpawnLocation;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
TObjectPtr<AActor> Attractor;
|
||||||
|
|
||||||
|
float MoveTime = 0.f;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ALMItemDrop();
|
ALMItemDrop();
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
void SetAttractor(AActor* Target);
|
||||||
|
UFUNCTION()
|
||||||
|
void DoMovingTowardsTarget();
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
virtual void ConsumePack(ALMPlayer* Player);
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintImplementableEvent)
|
||||||
|
void OnPackConsumed();
|
||||||
|
|
||||||
|
FVector GetSpawnLocation() const { return SpawnLocation; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UFUNCTION(BlueprintCallable)
|
UFUNCTION(BlueprintCallable)
|
||||||
void Despawn();
|
void Despawn();
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "LMBulletInfo.h"
|
#include "LMBulletInfo.h"
|
||||||
#include "LMTeam.h"
|
#include "LMTeam.h"
|
||||||
|
#include "Ammo/LMAmmoPack.h"
|
||||||
#include "Camera/CameraComponent.h"
|
#include "Camera/CameraComponent.h"
|
||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
#include "LMPlayer.generated.h"
|
#include "LMPlayer.generated.h"
|
||||||
@ -56,6 +57,9 @@ public:
|
|||||||
|
|
||||||
virtual bool CanJumpInternal_Implementation() const override;
|
virtual bool CanJumpInternal_Implementation() const override;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void AddAmmo(EAmmoType Ammo, int AmmoCount);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Called when the game starts or when spawned
|
// Called when the game starts or when spawned
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
|
@ -54,7 +54,6 @@ private:
|
|||||||
UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = true))
|
UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = true))
|
||||||
TObjectPtr<ALMPlayer> LegumixPlayer;
|
TObjectPtr<ALMPlayer> LegumixPlayer;
|
||||||
|
|
||||||
|
|
||||||
virtual void SetupInputComponent() override;
|
virtual void SetupInputComponent() override;
|
||||||
void Move(const FInputActionValue& InputValue);
|
void Move(const FInputActionValue& InputValue);
|
||||||
void Jump(const FInputActionValue& InputValue);
|
void Jump(const FInputActionValue& InputValue);
|
||||||
@ -68,6 +67,10 @@ private:
|
|||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true, UIMin=0.01, ClampMin=0.01, UIMax=10.0, ClampMax=10.0))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true, UIMin=0.01, ClampMin=0.01, UIMax=10.0, ClampMax=10.0))
|
||||||
float Sensitivity = 1.0f;
|
float Sensitivity = 1.0f;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true, ClampMin = 0.f))
|
||||||
|
float SwitchWeaponDelay = 0.1f;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UFUNCTION(BlueprintCallable, Category = Legumix)
|
UFUNCTION(BlueprintCallable, Category = Legumix)
|
||||||
@ -75,4 +78,9 @@ private:
|
|||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category = Legumix)
|
UFUNCTION(BlueprintCallable, Category = Legumix)
|
||||||
void OnSettingsChanged();
|
void OnSettingsChanged();
|
||||||
|
|
||||||
|
void ScrollEnded();
|
||||||
|
|
||||||
|
FTimerHandle ScrollTimer;
|
||||||
|
bool bIsScrolling;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user