Advertisement
Dieton

Weapon.h

Dec 13th, 2023 (edited)
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.71 KB | Gaming | 0 0
  1. // Fill out your copyright notice in the Description page of Project Settings.
  2.  
  3. #pragma once
  4.  
  5. #include "CoreMinimal.h"
  6. #include "Items/Item.h"
  7. #include "Weapon.generated.h"
  8.  
  9. class USoundBase;
  10. class UBoxComponent;
  11.  
  12.  
  13. UCLASS()
  14. class SLASH_API AWeapon : public AItem
  15. {
  16.     GENERATED_BODY()
  17.  
  18. public:
  19.     AWeapon();
  20.  
  21.     void Equip(USceneComponent* InParent, FName InSocketName);
  22.  
  23.     void AttachMeshToSocket(USceneComponent* InParent, const FName& InSocketName);
  24.  
  25.     TArray<AActor*> IgnoreActors;
  26.  
  27.     UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "BpIsOverlaped", meta = (AllowPrivateAccess = "true"))
  28.     bool bIsInOverlap;
  29.  
  30. protected:
  31.     virtual void BeginPlay() override;
  32.  
  33.     virtual void OnSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult) override;
  34.     virtual void OnSphereEndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex) override;
  35.    
  36.     UFUNCTION()
  37.     void OnBoxOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
  38.  
  39.     UFUNCTION(BlueprintImplementableEvent)
  40.     void CreateFields(const FVector& FieldLocation);
  41.  
  42. private:
  43.  
  44.     UPROPERTY(EditAnywhere, Category = "Weapon Properties")
  45.     USoundBase* EquipSound;
  46.  
  47.     UPROPERTY(EditAnywhere, Category = "Weapon Properties")
  48.     UBoxComponent* WeaponBox;
  49.    
  50.     UPROPERTY(EditAnywhere)
  51.     USceneComponent* BoxTraceStart;
  52.  
  53.     UPROPERTY(EditAnywhere)
  54.     USceneComponent* BoxTraceEnd;
  55.  
  56. public:
  57.     FORCEINLINE UBoxComponent* GetWeaponBox() const { return WeaponBox; }
  58. };
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement