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