Commit 880edf7f authored by Carl Findahl's avatar Carl Findahl 💬
Browse files

Improve Arena map and main menu. Start on Arena Code

parent 74493926
No preview for this file type
// Carl, Tomas, Jon Gunnar, Leon - 2019
#include "VikingArenaGameMode.h"
bool AVikingArenaGameMode::ReadyToStartMatch_Implementation()
{
Super::ReadyToStartMatch_Implementation();
return GetNumPlayers() == MaxPlayers;
}
AVikingArenaGameMode::AVikingArenaGameMode()
{
}
void AVikingArenaGameMode::PostLogin(APlayerController* NewPlayer)
{
Super::PostLogin(NewPlayer);
UE_LOG(LogTemp, Warning, TEXT("A new player has joined..."));
}
// Carl, Tomas, Jon Gunnar, Leon - 2019
#include "VikingArenaGameState.h"
void AVikingArenaGameState::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
TimeLeft -= DeltaSeconds;
}
void AVikingArenaGameState::Reset(float RoundDuration /*= 120.f*/, int32 InPurchasePoints /*= 150*/)
{
TimeLeft = RoundDuration;
PurchasePoints = InPurchasePoints;
}
// Carl, Tomas, Jon Gunnar, Leon - 2019
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameMode.h"
#include "VikingArenaGameMode.generated.h"
/**
* Game mode for the Arena (PvP) mode
*/
UCLASS()
class VIKING_API AVikingArenaGameMode : public AGameMode
{
GENERATED_BODY()
private:
protected:
/** Max players in Arena */
UPROPERTY(BlueprintReadOnly, Category = ArenaMode)
int32 MaxPlayers = 2;
virtual bool ReadyToStartMatch_Implementation() override;
public:
AVikingArenaGameMode();
virtual void PostLogin(APlayerController* NewPlayer) override;
};
// Carl, Tomas, Jon Gunnar, Leon - 2019
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameState.h"
#include "VikingArenaGameState.generated.h"
/**
*
*/
UCLASS()
class VIKING_API AVikingArenaGameState : public AGameState
{
GENERATED_BODY()
protected:
/** Time left of arena battle */
UPROPERTY(BlueprintReadOnly, Category = ArenaMode)
float TimeLeft = 120.f;
/** Number of points to buy equipment */
UPROPERTY(BlueprintReadOnly, Category = ArenaMode)
int32 PurchasePoints = 150;
public:
virtual void Tick(float DeltaSeconds) override;
/** Reset state to start a new round */
void Reset(float RoundDuration = 120.f, int32 InPurchasePoints = 150);
};
......@@ -14,6 +14,11 @@ class VIKING_API AVikingPlayerState : public APlayerState
{
GENERATED_BODY()
protected:
/** Number of kills by this player */
UPROPERTY(BlueprintReadOnly, Category = PlayerState)
int32 Kills = 0;
public:
AVikingPlayerState();
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment