60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Item.h"
|
|
#include "AmmoType.h"
|
|
#include "Ammo.generated.h"
|
|
|
|
class USphereComponent;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
UCLASS()
|
|
class SHOOTER_API AAmmo : public AItem
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
AAmmo();
|
|
|
|
virtual void Tick(float DeltaTime) override;
|
|
|
|
protected:
|
|
virtual void BeginPlay() override;
|
|
|
|
/** Override of SetItemProperties so we can set AmmoMesh properties */
|
|
virtual void SetItemProperties(EItemState State) override;
|
|
|
|
/* Called when overlapping AmmoCollisionSphere */
|
|
UFUNCTION()
|
|
void OnAmmoSphereOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
|
|
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
|
|
const FHitResult& SweepResult);
|
|
|
|
private:
|
|
/** Mesh for the ammo pickup */
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Ammo, meta = (AllowPrivateAccess="true"))
|
|
UStaticMeshComponent* AmmoMesh;
|
|
|
|
/** Ammo type for the ammo */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Ammo, meta = (AllowPrivateAccess="true"))
|
|
EAmmoType AmmoType;
|
|
|
|
/** The texture for the Ammo icon */
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Ammo, meta = (AllowPrivateAccess="true"))
|
|
UTexture2D* AmmoIconTexture;
|
|
|
|
/** Overlap sphere for picking up the ammo */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ammo, meta = (AllowPrivateAccess="true"))
|
|
USphereComponent* AmmoCollisionSphere;
|
|
public:
|
|
FORCEINLINE UStaticMeshComponent* GetAmmoMesh() const { return AmmoMesh; }
|
|
FORCEINLINE EAmmoType GetAmmoType() const { return AmmoType; }
|
|
|
|
virtual void EnableCustomDepth() override;
|
|
virtual void DisableCustomDepth() override;
|
|
};
|