diff --git a/Content/Assets/Items/OverCharge_BP.uasset b/Content/Assets/Items/OverCharge_BP.uasset new file mode 100644 index 0000000..79b0299 --- /dev/null +++ b/Content/Assets/Items/OverCharge_BP.uasset Binary files differ diff --git a/Content/Assets/NormieAsset/Test_anim.uasset b/Content/Assets/NormieAsset/Test_anim.uasset index bd660bc..de81fb1 100644 --- a/Content/Assets/NormieAsset/Test_anim.uasset +++ b/Content/Assets/NormieAsset/Test_anim.uasset Binary files differ diff --git a/Content/Levels/Sergio_Level.umap b/Content/Levels/Sergio_Level.umap index 3036d45..f9c00d9 100644 --- a/Content/Levels/Sergio_Level.umap +++ b/Content/Levels/Sergio_Level.umap Binary files differ diff --git a/Content/PlaneTest/Missile.uasset b/Content/PlaneTest/Missile.uasset index aa593b5..b046bbf 100644 --- a/Content/PlaneTest/Missile.uasset +++ b/Content/PlaneTest/Missile.uasset Binary files differ diff --git a/Content/PlaneTest/Projectile_BP.uasset b/Content/PlaneTest/Projectile_BP.uasset index c797cc7..9b10cf5 100644 --- a/Content/PlaneTest/Projectile_BP.uasset +++ b/Content/PlaneTest/Projectile_BP.uasset Binary files differ diff --git a/Content/PlaneTest/Targets_BP.uasset b/Content/PlaneTest/Targets_BP.uasset index 9f920bb..0126f67 100644 --- a/Content/PlaneTest/Targets_BP.uasset +++ b/Content/PlaneTest/Targets_BP.uasset Binary files differ diff --git a/Source/SkyFrontier/Private/DamageSystem.cpp b/Source/SkyFrontier/Private/DamageSystem.cpp new file mode 100644 index 0000000..6ffce29 --- /dev/null +++ b/Source/SkyFrontier/Private/DamageSystem.cpp @@ -0,0 +1,54 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "DamageSystem.h" + +// Sets default values for this component's properties +UDamageSystem::UDamageSystem() +{ + PrimaryComponentTick.bCanEverTick = false; + PrimaryComponentTick.bStartWithTickEnabled = false; +} + + +// Called when the game starts +void UDamageSystem::BeginPlay() +{ + Super::BeginPlay(); + ShootingDamage = 20; + MissileDamage = 50; + +} + +float UDamageSystem::GetShootingDamage() const +{ + return ShootingDamage; +} + +float UDamageSystem::GetMissileDamage() const +{ + return MissileDamage; +} + +void UDamageSystem::MultiplyDamage(const float Amount) +{ + if(Amount >= 0) + { + ShootingDamage *= Amount; + MissileDamage *= Amount; + + OnIncreaseDamageEvent.Broadcast(Amount); + } +} + +void UDamageSystem::RestoreDamage(const float Amount) +{ + if(Amount >= 0) + { + ShootingDamage /= Amount; + MissileDamage /= Amount; + + OnIncreaseDamageEvent.Broadcast(Amount); + } +} + diff --git a/Source/SkyFrontier/Private/HealthSystem.cpp b/Source/SkyFrontier/Private/HealthSystem.cpp index 59e7244..3643f42 100644 --- a/Source/SkyFrontier/Private/HealthSystem.cpp +++ b/Source/SkyFrontier/Private/HealthSystem.cpp @@ -5,7 +5,6 @@ UHealthSystem::UHealthSystem() { - // This is a component that doesn't need a tick so lets disable it PrimaryComponentTick.bCanEverTick = false; PrimaryComponentTick.bStartWithTickEnabled = false; } @@ -13,8 +12,7 @@ void UHealthSystem::BeginPlay() { Super::BeginPlay(); - - MaxHealth = 100; + Health = MaxHealth; Shield = 0; } diff --git a/Source/SkyFrontier/Public/DamageSystem.h b/Source/SkyFrontier/Public/DamageSystem.h new file mode 100644 index 0000000..3f660d8 --- /dev/null +++ b/Source/SkyFrontier/Public/DamageSystem.h @@ -0,0 +1,45 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Components/ActorComponent.h" +#include "DamageSystem.generated.h" + +DECLARE_EVENT_OneParam(UCPP_DamageComponent, IncreaseDamageEvent, float ) +DECLARE_EVENT_OneParam(UCPP_DamageComponent, DecreaseDamageEvent, float ) + +UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) +class SKYFRONTIER_API UDamageSystem : public UActorComponent +{ + GENERATED_BODY() + +public: + UDamageSystem(); + + UFUNCTION(BlueprintPure) + float GetShootingDamage() const; + UFUNCTION(BlueprintPure) + float GetMissileDamage() const; + + UFUNCTION(BlueprintCallable) + void MultiplyDamage(float Amount); + UFUNCTION(BlueprintCallable) + void RestoreDamage(float Amount); + +protected: + // Called when the game starts + virtual void BeginPlay() override; + +public: // Events + IncreaseDamageEvent OnIncreaseDamageEvent; + DecreaseDamageEvent OnDecreaseDamageEvent; + +private: // This can be protected if we want to subclass the Health Component + + UPROPERTY(EditAnywhere) + float ShootingDamage; + UPROPERTY(EditAnywhere) + float MissileDamage; + +};