This repository has been archived by the owner on Aug 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Burst firemode (with 2round and 3round blueprints).
Fixed overriding GetWorld() in BaseEmpiresWeapon and BaseFiremode
- Loading branch information
1 parent
6971361
commit db59ffd
Showing
15 changed files
with
86 additions
and
4 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#include "Empires2.h" | ||
#include "BurstFiremode.h" | ||
|
||
|
||
UBurstFiremode::UBurstFiremode(const class FPostConstructInitializeProperties& PCIP) | ||
: Super(PCIP) | ||
{ | ||
|
||
} | ||
|
||
void UBurstFiremode::BeginFire() | ||
{ | ||
Super::BeginFire(); | ||
|
||
BurstsRemaining = ShotsInBurst; | ||
|
||
//Start a timer based off the first shot time | ||
float FirstShotTime = Weapon->GetActiveFiremodeData().FirstShotFireDelay; | ||
if (FirstShotTime != 0) | ||
{ | ||
GetWorld()->GetTimerManager().SetTimer(this, &UBurstFiremode::HandleFire, FirstShotTime, false); | ||
} | ||
else | ||
{ | ||
HandleFire(); | ||
} | ||
} | ||
|
||
void UBurstFiremode::HandleFire() | ||
{ | ||
BurstsRemaining--; | ||
|
||
Weapon->FireShot(); | ||
|
||
if (IsFiring() && BurstsRemaining > 0) | ||
{ | ||
//get the time until the next shot | ||
float FireTime = (1.0f / Weapon->GetActiveFiremodeData().RoundsPerMinute) * 60.0f; | ||
|
||
GetWorld()->GetTimerManager().SetTimer(this, &UBurstFiremode::HandleFire, FireTime, false); | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#pragma once | ||
|
||
#include "BaseFiremode.h" | ||
#include "BurstFiremode.generated.h" | ||
|
||
/** | ||
* | ||
*/ | ||
UCLASS(Blueprintable) | ||
class EMPIRES2_API UBurstFiremode : public UBaseFiremode | ||
{ | ||
GENERATED_UCLASS_BODY() | ||
|
||
public: | ||
virtual void BeginFire() override; | ||
|
||
virtual void HandleFire() override; | ||
|
||
|
||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = Firemode) | ||
int32 ShotsInBurst; | ||
protected: | ||
int32 BurstsRemaining; | ||
|
||
|
||
}; |