Download LyraStarterGame/Source/LyraGame/Weapons/LyraWeaponSpawner.h from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 4.06 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/Weapons/LyraWeaponSpawner.h
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraGame/Weapons/LyraWeaponSpawner.h
-
curl -L -o LyraWeaponSpawner.h https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/Weapons/LyraWeaponSpawner.h
4.06 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| namespace EEndPlayReason { enum Type : int; } | |
| class APawn; | |
| class UCapsuleComponent; | |
| class ULyraInventoryItemDefinition; | |
| class ULyraWeaponPickupDefinition; | |
| class UObject; | |
| class UPrimitiveComponent; | |
| class UStaticMeshComponent; | |
| struct FFrame; | |
| struct FGameplayTag; | |
| struct FHitResult; | |
| UCLASS(MinimalAPI, Blueprintable,BlueprintType) | |
| class ALyraWeaponSpawner : public AActor | |
| { | |
| GENERATED_BODY() | |
| public: | |
| // Sets default values for this actor's properties | |
| UE_API ALyraWeaponSpawner(); | |
| protected: | |
| // Called when the game starts or when spawned | |
| UE_API virtual void BeginPlay() override; | |
| UE_API virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; | |
| public: | |
| // Called every frame | |
| UE_API virtual void Tick(float DeltaTime) override; | |
| UE_API void OnConstruction(const FTransform& Transform) override; | |
| protected: | |
| //Data asset used to configure a Weapon Spawner | |
| UPROPERTY(EditInstanceOnly, BlueprintReadOnly, Category = "Lyra|WeaponPickup") | |
| TObjectPtr<ULyraWeaponPickupDefinition> WeaponDefinition; | |
| UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, ReplicatedUsing = OnRep_WeaponAvailability, Category = "Lyra|WeaponPickup") | |
| bool bIsWeaponAvailable; | |
| //The amount of time between weapon pickup and weapon spawning in seconds | |
| UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Lyra|WeaponPickup") | |
| float CoolDownTime; | |
| //Delay between when the weapon is made available and when we check for a pawn standing in the spawner. Used to give the bIsWeaponAvailable OnRep time to fire and play FX. | |
| UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Lyra|WeaponPickup") | |
| float CheckExistingOverlapDelay; | |
| //Used to drive weapon respawn time indicators 0-1 | |
| UPROPERTY(BlueprintReadOnly, Transient, Category = "Lyra|WeaponPickup") | |
| float CoolDownPercentage; | |
| public: | |
| UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Lyra|WeaponPickup") | |
| TObjectPtr<UCapsuleComponent> CollisionVolume; | |
| UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Lyra|WeaponPickup") | |
| TObjectPtr<UStaticMeshComponent> PadMesh; | |
| UPROPERTY(BlueprintReadOnly, Category = "Lyra|WeaponPickup") | |
| TObjectPtr<UStaticMeshComponent> WeaponMesh; | |
| UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Lyra|WeaponPickup") | |
| float WeaponMeshRotationSpeed; | |
| FTimerHandle CoolDownTimerHandle; | |
| FTimerHandle CheckOverlapsDelayTimerHandle; | |
| UFUNCTION() | |
| UE_API void OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepHitResult); | |
| //Check for pawns standing on pad when the weapon is spawned. | |
| UE_API void CheckForExistingOverlaps(); | |
| UFUNCTION(BlueprintNativeEvent) | |
| UE_API void AttemptPickUpWeapon(APawn* Pawn); | |
| UFUNCTION(BlueprintImplementableEvent, Category = "Lyra|WeaponPickup") | |
| UE_API bool GiveWeapon(TSubclassOf<ULyraInventoryItemDefinition> WeaponItemClass, APawn* ReceivingPawn); | |
| UE_API void StartCoolDown(); | |
| UFUNCTION(BlueprintCallable, Category = "Lyra|WeaponPickup") | |
| UE_API void ResetCoolDown(); | |
| UFUNCTION() | |
| UE_API void OnCoolDownTimerComplete(); | |
| UE_API void SetWeaponPickupVisibility(bool bShouldBeVisible); | |
| UFUNCTION(BlueprintNativeEvent, Category = "Lyra|WeaponPickup") | |
| UE_API void PlayPickupEffects(); | |
| UFUNCTION(BlueprintNativeEvent, Category = "Lyra|WeaponPickup") | |
| UE_API void PlayRespawnEffects(); | |
| UFUNCTION() | |
| UE_API void OnRep_WeaponAvailability(); | |
| /** Searches an item definition type for a matching stat and returns the value, or 0 if not found */ | |
| UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Lyra|WeaponPickup") | |
| static UE_API int32 GetDefaultStatFromItemDef(const TSubclassOf<ULyraInventoryItemDefinition> WeaponItemClass, FGameplayTag StatTag); | |
| }; | |