First commit
This commit is contained in:
60
Source/ProjectLighthouse/TP_WeaponComponent.h
Normal file
60
Source/ProjectLighthouse/TP_WeaponComponent.h
Normal file
@@ -0,0 +1,60 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/SkeletalMeshComponent.h"
|
||||
#include "TP_WeaponComponent.generated.h"
|
||||
|
||||
class AProjectLighthouseCharacter;
|
||||
|
||||
UCLASS(Blueprintable, BlueprintType, ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||
class PROJECTLIGHTHOUSE_API UTP_WeaponComponent : public USkeletalMeshComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
/** Projectile class to spawn */
|
||||
UPROPERTY(EditDefaultsOnly, Category=Projectile)
|
||||
TSubclassOf<class AProjectLighthouseProjectile> ProjectileClass;
|
||||
|
||||
/** Sound to play each time we fire */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Gameplay)
|
||||
USoundBase* FireSound;
|
||||
|
||||
/** AnimMontage to play each time we fire */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Gameplay)
|
||||
UAnimMontage* FireAnimation;
|
||||
|
||||
/** Gun muzzle's offset from the characters location */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Gameplay)
|
||||
FVector MuzzleOffset;
|
||||
|
||||
/** MappingContext */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
||||
class UInputMappingContext* FireMappingContext;
|
||||
|
||||
/** Fire Input Action */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
|
||||
class UInputAction* FireAction;
|
||||
|
||||
/** Sets default values for this component's properties */
|
||||
UTP_WeaponComponent();
|
||||
|
||||
/** Attaches the actor to a FirstPersonCharacter */
|
||||
UFUNCTION(BlueprintCallable, Category="Weapon")
|
||||
bool AttachWeapon(AProjectLighthouseCharacter* TargetCharacter);
|
||||
|
||||
/** Make the weapon Fire a Projectile */
|
||||
UFUNCTION(BlueprintCallable, Category="Weapon")
|
||||
void Fire();
|
||||
|
||||
protected:
|
||||
/** Ends gameplay for this component. */
|
||||
UFUNCTION()
|
||||
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
||||
|
||||
private:
|
||||
/** The Character holding this weapon*/
|
||||
AProjectLighthouseCharacter* Character;
|
||||
};
|
||||
Reference in New Issue
Block a user