Implement basic combat system
This commit is contained in:
@@ -38,9 +38,6 @@ protected:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
|
||||
class UInputAction* MouseLookAction;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
|
||||
class UInputAction* FireAction;
|
||||
|
||||
// Movement Parameters
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Movement")
|
||||
float MaxThrust = 2000.0f;
|
||||
@@ -67,11 +64,24 @@ protected:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Movement", meta = (ClampMin = "0.0", ClampMax = "1.0", ToolTip = "How much of the current velocity is maintained when changing direction (0 = none, 1 = full)"))
|
||||
float DirectionalInertia = 0.3f;
|
||||
|
||||
// Shooting properties
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Combat")
|
||||
TSubclassOf<class ASpaceshipProjectile> ProjectileClass;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Combat")
|
||||
float FireRate = 0.2f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Combat")
|
||||
USceneComponent* ProjectileSpawnPoint;
|
||||
|
||||
// Input action for shooting
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
|
||||
class UInputAction* ShootAction;
|
||||
|
||||
// Input functions
|
||||
void HandleThrottleStarted(const FInputActionValue& Value);
|
||||
void HandleThrottleReleased(const FInputActionValue& Value);
|
||||
void HandleMouseLook(const FInputActionValue& Value);
|
||||
void HandleFire(const FInputActionValue& Value);
|
||||
|
||||
private:
|
||||
// Movement state
|
||||
@@ -91,4 +101,11 @@ private:
|
||||
|
||||
bool bWasThrottlePressed;
|
||||
FVector DesiredVelocityDirection;
|
||||
|
||||
FTimerHandle FireTimerHandle;
|
||||
bool bCanFire = true;
|
||||
|
||||
void HandleShoot(const FInputActionValue& Value);
|
||||
void Fire();
|
||||
void ResetFire();
|
||||
};
|
||||
Reference in New Issue
Block a user