Implemented basic grenade interaction: - Player can pick up, throw, and drop grenades. To-do: - Refine throwing mechanics (e.g. direction, force). - Clean up and refactor related code.
60 lines
1.5 KiB
C++
60 lines
1.5 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Actor.h"
|
|
#include "Interfaces/Interactable.h"
|
|
#include "ThrowableBase.generated.h"
|
|
|
|
UENUM()
|
|
enum class ThrowableType : uint8
|
|
{
|
|
Hit UMETA(DisplayName = "Hit"),
|
|
Explode UMETA(DisplayName = "Explode"),
|
|
Area UMETA(DisplayName = "Area")
|
|
};
|
|
|
|
UCLASS()
|
|
class EXO_API AThrowableBase : public AActor, public IInteractable
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
AThrowableBase();
|
|
|
|
virtual void Interact_Implementation(AExoPlayerCharacter* PlayerCharacter) override;
|
|
|
|
TSubclassOf<AActor> SceneItemClass;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Throw")
|
|
TObjectPtr<USceneComponent> RootSceneComponent;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Throw")
|
|
TObjectPtr<UStaticMeshComponent> Mesh;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Throw Details")
|
|
int Quantity = 1;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Throw Details")
|
|
int MaxQuantity = 6;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Throw Details")
|
|
int NumberOfBounces = 0;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Effect")
|
|
ThrowableType ThrowableType = ThrowableType::Hit;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Effect")
|
|
float Damage = 100.f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Effect")
|
|
float Radius = 0.f;
|
|
|
|
protected:
|
|
UFUNCTION(BlueprintCallable, Category = "Effect")
|
|
virtual void EffectActivate();
|
|
|
|
};
|
|
|