diff --git a/Content/Assets/Items/MagneticShield_BP.uasset b/Content/Assets/Items/MagneticShield_BP.uasset index dd5e85a..b2ec69c 100644 --- a/Content/Assets/Items/MagneticShield_BP.uasset +++ b/Content/Assets/Items/MagneticShield_BP.uasset Binary files differ diff --git a/Content/Assets/Items/RepairKit_BP.uasset b/Content/Assets/Items/RepairKit_BP.uasset index bcc4530..24c8746 100644 --- a/Content/Assets/Items/RepairKit_BP.uasset +++ b/Content/Assets/Items/RepairKit_BP.uasset Binary files differ diff --git a/Content/Assets/NormieAsset/Test_anim.uasset b/Content/Assets/NormieAsset/Test_anim.uasset index b45bb95..8e13ee1 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 68785d3..9df1dc2 100644 --- a/Content/Levels/Sergio_Level.umap +++ b/Content/Levels/Sergio_Level.umap Binary files differ diff --git a/Content/PlaneTest/Targets_BP.uasset b/Content/PlaneTest/Targets_BP.uasset index 29f1c42..9461c0d 100644 --- a/Content/PlaneTest/Targets_BP.uasset +++ b/Content/PlaneTest/Targets_BP.uasset Binary files differ diff --git a/Source/SkyFrontier/Private/HealthSystem.cpp b/Source/SkyFrontier/Private/HealthSystem.cpp index d158630..59e7244 100644 --- a/Source/SkyFrontier/Private/HealthSystem.cpp +++ b/Source/SkyFrontier/Private/HealthSystem.cpp @@ -14,7 +14,7 @@ { Super::BeginPlay(); - // This is here for now, but if you ever do anything serialization related you might not want this. + MaxHealth = 100; Health = MaxHealth; Shield = 0; } @@ -64,17 +64,35 @@ if(Amount > 0) { Health += Amount; - + if (Health >= MaxHealth) + { + Health = MaxHealth; + } + OnDamageHealedEvent.Broadcast(Amount); } } void UHealthSystem::ReceiveShield(const float Amount) { - if(Amount > 0) + if(Amount >= 0) { Shield += Amount; OnShieldReceiveEvent.Broadcast(Amount); } +} + +void UHealthSystem::RemoveShield(const float Amount) +{ + if(Amount >= 0) + { + Shield -= Amount; + + if (Shield < 0) + { + Shield = 0; + } + OnShieldReceiveEvent.Broadcast(Amount); + } } \ No newline at end of file diff --git a/Source/SkyFrontier/Public/HealthSystem.h b/Source/SkyFrontier/Public/HealthSystem.h index 29880f3..3f5377b 100644 --- a/Source/SkyFrontier/Public/HealthSystem.h +++ b/Source/SkyFrontier/Public/HealthSystem.h @@ -37,6 +37,8 @@ void RecoverHealth(float Amount); UFUNCTION(BlueprintCallable) void ReceiveShield(float Amount); + UFUNCTION(BlueprintCallable) + void RemoveShield(float Amount); protected: // Functions @@ -56,5 +58,5 @@ float MaxHealth; UPROPERTY(VisibleAnywhere) float Shield; - + };