Newer
Older
SkyFrontier-Project-IADE-UE4-3D / Source / SkyFrontier / Public / DamageSystem.h
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2. #pragma once
  3. #include "CoreMinimal.h"
  4. #include "Components/ActorComponent.h"
  5. #include "DamageSystem.generated.h"
  6. DECLARE_EVENT_OneParam(UCPP_DamageComponent, IncreaseDamageEvent, float )
  7. DECLARE_EVENT_OneParam(UCPP_DamageComponent, DecreaseDamageEvent, float )
  8. UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
  9. class SKYFRONTIER_API UDamageSystem : public UActorComponent
  10. {
  11. GENERATED_BODY()
  12. public:
  13. UDamageSystem();
  14. UFUNCTION(BlueprintPure)
  15. float GetShootingDamage() const;
  16. UFUNCTION(BlueprintPure)
  17. float GetMissileDamage() const;
  18. UFUNCTION(BlueprintCallable)
  19. void MultiplyDamage(float Amount);
  20. UFUNCTION(BlueprintCallable)
  21. void RestoreDamage(float Amount);
  22. protected:
  23. // Called when the game starts
  24. virtual void BeginPlay() override;
  25. public: // Events
  26. IncreaseDamageEvent OnIncreaseDamageEvent;
  27. DecreaseDamageEvent OnDecreaseDamageEvent;
  28. private: // This can be protected if we want to subclass the Health Component
  29. UPROPERTY(EditAnywhere)
  30. float ShootingDamage;
  31. UPROPERTY(EditAnywhere)
  32. float MissileDamage;
  33. };