blaster/Source/Blaster/Weapon/Projectile.h

90 lines
2.1 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Particles/ParticleSystemComponent.h"
#include "Projectile.generated.h"
UCLASS()
class BLASTER_API AProjectile : public AActor
{
GENERATED_BODY()
public:
AProjectile();
virtual void Tick(float DeltaTime) override;
// Used with server-side rewind
bool bUseServerSideRewind = false;
FVector_NetQuantize TraceStart;
FVector_NetQuantize100 InitialVelocity;
UPROPERTY(EditAnywhere)
float InitialSpeed = 25000;
// SSR will get Damage directly from the weapon
// Non SSR, Damage will be set from the weapon
// Only set this for Grenades and Rockets
UPROPERTY(EditAnywhere)
float Damage = 20.f;
// SSR will get Damage directly from the weapon
// Non SSR, Damage will be set from the weapon
// Doesn't matter for Grenades and rockets
UPROPERTY(EditAnywhere)
float HeadShotDamage = 40.f;
protected:
virtual void BeginPlay() override;
void StartDestroyTimer();
void DestroyTimerFinished();
void SpawnTrailSystem();
void ExplodeDamage();
UFUNCTION()
virtual void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
virtual void Destroyed() override;
UPROPERTY(EditAnywhere)
class UParticleSystem* ImpactParticles;
UPROPERTY(EditAnywhere)
class USoundCue* ImpactSound;
UPROPERTY(EditAnywhere)
class UBoxComponent* CollisionBox;
UPROPERTY(VisibleAnywhere)
class UProjectileMovementComponent* ProjectileMovementComponent;
UPROPERTY(EditAnywhere)
class UNiagaraSystem* TrailSystem;
UPROPERTY()
class UNiagaraComponent* TrailSystemComponent;
UPROPERTY(VisibleAnywhere)
UStaticMeshComponent* ProjectileMesh;
UPROPERTY(EditAnywhere)
float DamageInnerRadius = 200.f;
UPROPERTY(EditAnywhere)
float DamageOuterRadius = 500.f;
private:
UPROPERTY(EditAnywhere)
class UParticleSystem* Tracer;
UPROPERTY()
class UParticleSystemComponent* TracerComponent;
FTimerHandle DestroyTimer;
UPROPERTY(EditAnywhere)
float DestroyTime = 3.f;
};