diff --git a/Content/Legumix/Ennemy/RangeEnemy/AI/EQS_RangeEnnemy.uasset b/Content/Legumix/Ennemy/RangeEnemy/AI/EQS_RangeEnnemy.uasset index 865fd00..841f57c 100644 --- a/Content/Legumix/Ennemy/RangeEnemy/AI/EQS_RangeEnnemy.uasset +++ b/Content/Legumix/Ennemy/RangeEnemy/AI/EQS_RangeEnnemy.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3157ebe08fc1aa3036b2f0372bcaa66836609c06cb575fa945eb8e97bd74846c +oid sha256:e325f95029f34b122a8e4c74cfceb712ab40a658d79d2d03bf62b991acd1e1a5 size 37808 diff --git a/Content/Legumix/Ennemy/RangeEnemy/AI/Task/BTTask_RangeAttack.uasset b/Content/Legumix/Ennemy/RangeEnemy/AI/Task/BTTask_RangeAttack.uasset index 2eb0628..2eda788 100644 --- a/Content/Legumix/Ennemy/RangeEnemy/AI/Task/BTTask_RangeAttack.uasset +++ b/Content/Legumix/Ennemy/RangeEnemy/AI/Task/BTTask_RangeAttack.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0fbc2555581f740c7b73ec47738a1bd5944b8823b10c148849f3b4e7faecb23b -size 38793 +oid sha256:4bc1ae4d1866751e5e37f55c1973966ab5449989e4ed118aaa605053358b646d +size 38916 diff --git a/Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset b/Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset index e444ba4..84f4b12 100644 --- a/Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset +++ b/Content/Legumix/Ennemy/RangeEnemy/BP_DistantEnemy.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dda5984c80cee7b6088ac03d673d871de0700d65af86e603515ed4d695ebfc4e -size 101222 +oid sha256:d3efe161fd0f1d377896c323389d06c9e546f298251d0874a778a3fc4d80cd0f +size 129890 diff --git a/Content/Legumix/Ennemy/RangeEnemy/Projectile/BP_Projectile.uasset b/Content/Legumix/Ennemy/RangeEnemy/Projectile/BP_Projectile.uasset index 509f964..459997b 100644 --- a/Content/Legumix/Ennemy/RangeEnemy/Projectile/BP_Projectile.uasset +++ b/Content/Legumix/Ennemy/RangeEnemy/Projectile/BP_Projectile.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2357065411e14ed7ae5e44663c3d5883ccba3c0203fd996bdd22a22cb1518153 -size 32023 +oid sha256:158be6df4930d58c4cbcda01c3bc2eaa26412952cd1e956e556eac62f68ed3ed +size 56803 diff --git a/Content/Legumix/Levels/LVL_GYM_00.umap b/Content/Legumix/Levels/LVL_GYM_00.umap index aebae42..d3bdbc4 100644 --- a/Content/Legumix/Levels/LVL_GYM_00.umap +++ b/Content/Legumix/Levels/LVL_GYM_00.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f367e9a989a37f5af630c2c2a3a79d5a8518ace5a9c4340b09f09222f062ff8 -size 987760 +oid sha256:9e4fc7e9b5f6fd3b4b48308f2ee330f92192db06d662f41e8bd1933e1ad846f0 +size 994556 diff --git a/Source/LegumeMix/Private/Enemy/DistantEnemy/Projectile/BPProjectile.cpp b/Source/LegumeMix/Private/Enemy/DistantEnemy/Projectile/BPProjectile.cpp deleted file mode 100644 index 13bbbb4..0000000 --- a/Source/LegumeMix/Private/Enemy/DistantEnemy/Projectile/BPProjectile.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - -#include "Enemy/DistantEnemy/Projectile/BPProjectile.h" -#include "Components/SphereComponent.h" - -// Sets default values -ABPProjectile::ABPProjectile() -{ - PrimaryActorTick.bCanEverTick = true; - ProjectileCollision = CreateDefaultSubobject(TEXT("ProjectileCollision")); - SetRootComponent(ProjectileCollision); - // Collisions : - ProjectileCollision->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics); - ProjectileCollision->SetNotifyRigidBodyCollision(true); - ProjectileCollision->BodyInstance.SetCollisionProfileName(TEXT("BlockAllDynamic")); - - ProjectileMesh = CreateDefaultSubobject(TEXT("ProjectileMesh")); - ProjectileMesh->SetupAttachment(ProjectileCollision); -} - -void ABPProjectile::BeginPlay() -{ - Super::BeginPlay(); - -} - -void ABPProjectile::Tick(float DeltaTime) -{ - Super::Tick(DeltaTime); - -} - diff --git a/Source/LegumeMix/Private/Enemy/DistantEnemy/Projectile/LMProjectile.cpp b/Source/LegumeMix/Private/Enemy/DistantEnemy/Projectile/LMProjectile.cpp new file mode 100644 index 0000000..919a2b1 --- /dev/null +++ b/Source/LegumeMix/Private/Enemy/DistantEnemy/Projectile/LMProjectile.cpp @@ -0,0 +1,75 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "Enemy/DistantEnemy/Projectile/LMProjectile.h" + +// #include "VectorTypes.h" +#include "Components/SphereComponent.h" +#include "GameFramework/ProjectileMovementComponent.h" +// #include "Player/LMHealthComponent.h" +// #include "Player/LMHitBox.h" +// #include "Player/LMPlayer.h" + +// Sets default values +ALMProjectile::ALMProjectile() +{ + PrimaryActorTick.bCanEverTick = true; + PrimaryActorTick.bCanEverTick = true; + ProjectileCollision = CreateDefaultSubobject(TEXT("ProjectileCollision")); + SetRootComponent(ProjectileCollision); + // // Collisions : + ProjectileCollision->SetCollisionEnabled(ECollisionEnabled::NoCollision); + ProjectileCollision->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Overlap); + // ProjectileCollision->OnComponentBeginOverlap.AddDynamic(this, &ALMProjectile::OnSphereOverlap); + + ProjectileMesh = CreateDefaultSubobject(TEXT("ProjectileMesh")); + ProjectileMesh->SetupAttachment(ProjectileCollision); + + ProjectileMovement = CreateDefaultSubobject(TEXT("ProjectileMovement")); +} + +// Called when the game starts or when spawned +void ALMProjectile::BeginPlay() +{ + Super::BeginPlay(); + InitialLocation = GetActorLocation(); + +} +// TO DEBUG OR ERASE +// void ALMProjectile::OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, +// UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) +// { +// if(GEngine) +// { +// GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Yellow, "1Damage"); +// } +// if(ALMPlayer* Player = Cast(OtherActor)) +// { +// if(GEngine) +// { +// GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Yellow, "2Damage"); +// } +// if (ULMHitBox* HitBox = Cast(OtherComp)) +// { +// Player->GetHealthComponent()->TakeDamage(AttackingDamage); +// if(GEngine) +// { +// GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Yellow, "3Damage"); +// } +// } +// } +// Destroy(); +// } + +// Called every frame +void ALMProjectile::Tick(float DeltaTime) +{ + Super::Tick(DeltaTime); + if(FVector::Distance(GetActorLocation(), InitialLocation) > MaxRange) + { + Destroy(); + } + + +} + diff --git a/Source/LegumeMix/Public/Enemy/DistantEnemy/Projectile/BPProjectile.h b/Source/LegumeMix/Public/Enemy/DistantEnemy/Projectile/BPProjectile.h deleted file mode 100644 index ca1193b..0000000 --- a/Source/LegumeMix/Public/Enemy/DistantEnemy/Projectile/BPProjectile.h +++ /dev/null @@ -1,33 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#pragma once - -#include "CoreMinimal.h" -#include "GameFramework/Actor.h" -#include "BPProjectile.generated.h" - -class UStaticMeshComponent; -class USphereComponent; - -UCLASS() -class LEGUMEMIX_API ABPProjectile : public AActor -{ - GENERATED_BODY() - -public: - ABPProjectile(); - -protected: - virtual void BeginPlay() override; - -public: - virtual void Tick(float DeltaTime) override; - -private: - UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true)) - TObjectPtr ProjectileCollision; - - UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true)) - TObjectPtr ProjectileMesh; - -}; diff --git a/Source/LegumeMix/Public/Enemy/DistantEnemy/Projectile/LMProjectile.h b/Source/LegumeMix/Public/Enemy/DistantEnemy/Projectile/LMProjectile.h new file mode 100644 index 0000000..e42471e --- /dev/null +++ b/Source/LegumeMix/Public/Enemy/DistantEnemy/Projectile/LMProjectile.h @@ -0,0 +1,46 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/Actor.h" +#include "LMProjectile.generated.h" + +class UStaticMeshComponent; +class USphereComponent; +class UProjectileMovementComponent; + +UCLASS() +class LEGUMEMIX_API ALMProjectile : public AActor +{ + GENERATED_BODY() + +public: + ALMProjectile(); + virtual void Tick(float DeltaTime) override; + +protected: + virtual void BeginPlay() override; + + // UFUNCTION(BlueprintCallable) + // void OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult); + + UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (AllowPrivateAccess = "true"), Category = "Legumix") + float AttackingDamage = 15.f; + +private: + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true)) + TObjectPtr ProjectileCollision; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true)) + TObjectPtr ProjectileMesh; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true)) + TObjectPtr ProjectileMovement; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Legumix, meta = (AllowPrivateAccess = true)) + float MaxRange = 1500.f; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true)) + FVector InitialLocation; +}; diff --git a/Source/LegumeMix/Public/Player/LMPlayer.h b/Source/LegumeMix/Public/Player/LMPlayer.h index 32d5236..100e739 100644 --- a/Source/LegumeMix/Public/Player/LMPlayer.h +++ b/Source/LegumeMix/Public/Player/LMPlayer.h @@ -113,6 +113,8 @@ public: USkeletalMeshComponent* GetArmsBP(); USkeletalMeshComponent* GetArms(); + FORCEINLINE ULMHealthComponent* GetHealthComponent() const { return HealthComponent; } + UPROPERTY(BlueprintCallable, BlueprintAssignable, Category=Legumix) FOnRequestUnpauseSignature OnRequestedUnpause;