92 lines
2.7 KiB
C++
92 lines
2.7 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Character.h"
|
|
#include "ShooterCharacter.generated.h"
|
|
|
|
class USpringArmComponent;
|
|
class UCameraComponent;
|
|
class USoundCue;
|
|
class UParticleSystem;
|
|
class UAnimMontage;
|
|
|
|
UCLASS()
|
|
class SHOOTER_API AShooterCharacter : public ACharacter
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// Sets default values for this character's properties
|
|
AShooterCharacter();
|
|
|
|
protected:
|
|
// Called when the game starts or when spawned
|
|
virtual void BeginPlay() override;
|
|
|
|
/* Called for forwards/backwards input */
|
|
void MoveForward(float Value);
|
|
|
|
/* Called for side to side input */
|
|
void MoveRight(float Value);
|
|
|
|
/**
|
|
* Called via input to turn at a given rate.
|
|
* @param Rate This is a normalized rate, i.e. 1.0 means 100% of desired rate
|
|
*/
|
|
void TurnAtRate(float Rate);
|
|
|
|
/**
|
|
* Called via input to look up/down at a given rate.
|
|
* @param Rate This is a normalized rate, i.e. 1.0 means 100% of desired rate
|
|
*/
|
|
void LookUpAtRate(float Rate);
|
|
|
|
/**
|
|
* Called when the Fire button is pressed
|
|
*/
|
|
void FireWeapon();
|
|
|
|
public:
|
|
// Called every frame
|
|
virtual void Tick(float DeltaTime) override;
|
|
|
|
// Called to bind functionality to input
|
|
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
|
|
|
private:
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = true))
|
|
USpringArmComponent* CameraBoom;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = true))
|
|
UCameraComponent* FollowCamera;
|
|
|
|
/* Base turn rate, in deg/sec. Other scaling may affect final rate */
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = true))
|
|
float BaseTurnRate;
|
|
|
|
/* Base look up/down rate, in deg/sec. Other scaling may affect final rate */
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = true))
|
|
float BaseLookUpRate;
|
|
|
|
/* Randomized gunshot sound cue*/
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Combat, meta = (AllowPrivateAccess = true))
|
|
USoundCue* FireSound;
|
|
|
|
/* Flash spawned at BarrelSocket */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Combat, meta = (AllowPrivateAccess = true))
|
|
UParticleSystem* MuzzleFlash;
|
|
|
|
/* Montage for firing the weapon */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Combat, meta = (AllowPrivateAccess = true))
|
|
UAnimMontage* HipFireMontage;
|
|
|
|
public:
|
|
/* Returns CameraBoom SubObject */
|
|
FORCEINLINE USpringArmComponent* GetCameraBoom() const { return CameraBoom; }
|
|
|
|
/* Returns FollowCamera SubObject */
|
|
FORCEINLINE UCameraComponent* GetFollowCamera() const { return FollowCamera; }
|
|
};
|