blaster/Source/Blaster/Weapon/Projectile.h

90 lines
2.1 KiB
C
Raw Permalink Normal View History

2022-05-04 17:17:25 +00:00
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
2022-05-05 12:15:25 +00:00
#include "Particles/ParticleSystemComponent.h"
2022-05-04 17:17:25 +00:00
#include "Projectile.generated.h"
UCLASS()
class BLASTER_API AProjectile : public AActor
{
GENERATED_BODY()
public:
AProjectile();
virtual void Tick(float DeltaTime) override;
2022-05-27 20:37:59 +00:00
// Used with server-side rewind
bool bUseServerSideRewind = false;
FVector_NetQuantize TraceStart;
FVector_NetQuantize100 InitialVelocity;
UPROPERTY(EditAnywhere)
2022-05-29 12:35:57 +00:00
float InitialSpeed = 25000;
2022-05-27 21:33:52 +00:00
2022-05-29 12:35:57 +00:00
// 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)
2022-05-27 21:33:52 +00:00
float Damage = 20.f;
2022-05-29 12:35:57 +00:00
// 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;
2022-05-27 20:37:59 +00:00
2022-05-04 17:17:25 +00:00
protected:
virtual void BeginPlay() override;
2022-05-20 16:12:50 +00:00
void StartDestroyTimer();
void DestroyTimerFinished();
void SpawnTrailSystem();
void ExplodeDamage();
2022-05-05 13:02:47 +00:00
UFUNCTION()
virtual void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
virtual void Destroyed() override;
2022-05-07 11:03:19 +00:00
2022-05-04 17:17:25 +00:00
UPROPERTY(EditAnywhere)
2022-05-18 17:20:18 +00:00
class UParticleSystem* ImpactParticles;
2022-05-05 10:59:50 +00:00
2022-05-18 17:20:18 +00:00
UPROPERTY(EditAnywhere)
class USoundCue* ImpactSound;
UPROPERTY(EditAnywhere)
class UBoxComponent* CollisionBox;
2022-05-05 10:59:50 +00:00
UPROPERTY(VisibleAnywhere)
class UProjectileMovementComponent* ProjectileMovementComponent;
2022-05-20 16:12:50 +00:00
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;
2022-05-19 09:10:41 +00:00
private:
2022-05-05 12:15:25 +00:00
UPROPERTY(EditAnywhere)
class UParticleSystem* Tracer;
2022-05-09 15:16:41 +00:00
UPROPERTY()
2022-05-05 12:15:25 +00:00
class UParticleSystemComponent* TracerComponent;
2022-05-20 16:12:50 +00:00
FTimerHandle DestroyTimer;
UPROPERTY(EditAnywhere)
float DestroyTime = 3.f;
2022-05-04 17:17:25 +00:00
};