完善战斗开始等待时间
This commit is contained in:
parent
5023885530
commit
9363b2b09d
BIN
ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish-0001.dll
Normal file
BIN
ProjectFish/Binaries/Win64/UnrealEditor-ProjectFish-0001.dll
Normal file
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.
@ -2,7 +2,7 @@
|
||||
"BuildId": "37670630",
|
||||
"Modules":
|
||||
{
|
||||
"ProjectFish": "UnrealEditor-ProjectFish.dll",
|
||||
"ProjectFishEditor": "UnrealEditor-ProjectFishEditor.dll"
|
||||
"ProjectFish": "UnrealEditor-ProjectFish-0001.dll",
|
||||
"ProjectFishEditor": "UnrealEditor-ProjectFishEditor-0001.dll"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,6 +3,7 @@
|
||||
#include "ProjectFishGameMode.h"
|
||||
#include "ProjectFishPlayerController.h"
|
||||
#include "ProjectFishCharacter.h"
|
||||
#include "Settings/GameConfigSettings.h"
|
||||
#include "UObject/ConstructorHelpers.h"
|
||||
|
||||
AProjectFishGameMode::AProjectFishGameMode()
|
||||
@ -23,4 +24,22 @@ AProjectFishGameMode::AProjectFishGameMode()
|
||||
{
|
||||
PlayerControllerClass = PlayerControllerBPClass.Class;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void AProjectFishGameMode::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
const UGameConfigSettings* ConfigSettings = GetDefault<UGameConfigSettings>();
|
||||
FTimerHandle FishingTimerHandle;
|
||||
GetWorld()->GetTimerManager().SetTimer(FishingTimerHandle, [this]()
|
||||
{
|
||||
this->bBattleIsBegin = true;
|
||||
}, ConfigSettings->BattaleWatingTime, false);
|
||||
}
|
||||
|
||||
bool AProjectFishGameMode::GetBattleIsBegin() const
|
||||
{
|
||||
return bBattleIsBegin;
|
||||
}
|
||||
@ -13,6 +13,13 @@ class AProjectFishGameMode : public AGameModeBase
|
||||
|
||||
public:
|
||||
AProjectFishGameMode();
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
bool GetBattleIsBegin() const;
|
||||
|
||||
private:
|
||||
bool bBattleIsBegin = false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -22,5 +22,7 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, config)
|
||||
float MaxWaitingTime;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, config)
|
||||
float BattaleWatingTime = 1.0f;
|
||||
virtual FName GetCategoryName() const override;
|
||||
};
|
||||
|
||||
@ -3,9 +3,16 @@
|
||||
|
||||
#include "SkillManager.h"
|
||||
#include "Skill.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "ProjectFish/ProjectFishGameMode.h"
|
||||
#include "ProjectFish/DataAsset/BagConfigAsset.h"
|
||||
#include "ProjectFish/DataAsset/BagShapeAsset.h"
|
||||
|
||||
USkillManager::USkillManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void USkillManager::Tick(float DeltaTime)
|
||||
{
|
||||
for (auto Skill : Skills)
|
||||
@ -16,7 +23,7 @@ void USkillManager::Tick(float DeltaTime)
|
||||
|
||||
bool USkillManager::IsTickable() const
|
||||
{
|
||||
return !bGameEnd;
|
||||
return !bGameEnd && IsValid(GameMode) && GameMode->GetBattleIsBegin();
|
||||
}
|
||||
|
||||
TStatId USkillManager::GetStatId() const
|
||||
@ -26,6 +33,10 @@ TStatId USkillManager::GetStatId() const
|
||||
|
||||
void USkillManager::AddPawn(class APawnWithSkill* Pawn, FIntPoint BagSize)
|
||||
{
|
||||
if (!IsValid(GameMode))
|
||||
{
|
||||
GameMode = Cast<AProjectFishGameMode>(UGameplayStatics::GetGameMode(this));
|
||||
}
|
||||
PawnInfo.Add(Pawn, BagSize);
|
||||
TMap<FIntPoint, int32> states;
|
||||
for (int y = 0; y < BagSize.Y; y++)
|
||||
|
||||
@ -16,6 +16,8 @@ class PROJECTFISH_API USkillManager : public UObject, public FTickableGameObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
USkillManager();
|
||||
|
||||
virtual void Tick(float DeltaTime) override;
|
||||
virtual bool IsTickable() const override;
|
||||
virtual TStatId GetStatId() const override;
|
||||
@ -72,6 +74,9 @@ protected:
|
||||
bool bGameEnd = false;
|
||||
|
||||
TMap<APawnWithSkill*, TMap<FIntPoint, int32>> PawnBagState;
|
||||
|
||||
private:
|
||||
class AProjectFishGameMode* GameMode;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user