Initial commit

feature/refactor_menus
Jers 12 months ago
commit 6417d6644f

16
.gitattributes vendored

@ -0,0 +1,16 @@
# Unreal Engine file types.
*.uasset filter=lfs diff=lfs merge=lfs -text
*.umap filter=lfs diff=lfs merge=lfs -text
# Raw Content file types.
*.fbx filter=lfs diff=lfs merge=lfs -text
*.3ds filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.xcf filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
# Anything in `/RawContent` dir.
/RawContent/**/* filter=lfs diff=lfs merge=lfs -text

51
.gitignore vendored

@ -0,0 +1,51 @@
# Ignore all files by default, but scan all directories.
*
!*/
# Do not ignore git files in the root of the repo.
!/.git*
# Do not ignore current project's `.uproject`.
!/*.uproject
# Do not ignore source, config and plugins dirs.
!/Source/**
!/Config/**
!/Plugins/**
# Only allow .uasset and .umap files from /Content dir.
# They're tracked by git-lfs, don't forget to track other
# files if adding them here.
!/Content/**/*.uasset
!/Content/**/*.umap
# Allow any files from /RawContent dir.
# Any file in /RawContent dir will be managed by git lfs.
!/RawContent/**/*
# OS/platform generated files.
# Windows
ehthumbs.db
Thumbs.db
# Mac OS X
.DS_Store
.DS_Store?
.AppleDouble
.LSOverride
._*
# Linux
*~
.directory
# vim
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
# Visual Studio
.vs

@ -0,0 +1,7 @@
[/Script/AdvancedPreviewScene.SharedProfiles]
[/Script/CommonUI.CommonUIEditorSettings]
TemplateButtonStyle=/Game/Blueprints/UI/ButtonTemplate.ButtonTemplate_C
TemplateTextStyle=/Game/Blueprints/UI/TextStyle.TextStyle_C
TemplateBorderStyle=/Game/Blueprints/UI/BorderStyle.BorderStyle_C

@ -0,0 +1,79 @@
[/Script/EngineSettings.GameMapsSettings]
GameDefaultMap=/Game/Levels/MainMenu.MainMenu
GlobalDefaultGameMode=/Game/Blueprints/BP_GameMode.BP_GameMode_C
EditorStartupMap=/Game/Levels/MainMenu.MainMenu
[/Script/WindowsTargetPlatform.WindowsTargetSettings]
DefaultGraphicsRHI=DefaultGraphicsRHI_DX12
-D3D12TargetedShaderFormats=PCD3D_SM5
+D3D12TargetedShaderFormats=PCD3D_SM6
-D3D11TargetedShaderFormats=PCD3D_SM5
+D3D11TargetedShaderFormats=PCD3D_SM5
Compiler=Default
AudioSampleRate=48000
AudioCallbackBufferFrameSize=1024
AudioNumBuffersToEnqueue=1
AudioMaxChannels=0
AudioNumSourceWorkers=4
SpatializationPlugin=
SourceDataOverridePlugin=
ReverbPlugin=
OcclusionPlugin=
CompressionOverrides=(bOverrideCompressionTimes=False,DurationThreshold=5.000000,MaxNumRandomBranches=0,SoundCueQualityIndex=0)
CacheSizeKB=65536
MaxChunkSizeOverrideKB=0
bResampleForDevice=False
MaxSampleRate=48000.000000
HighSampleRate=32000.000000
MedSampleRate=24000.000000
LowSampleRate=12000.000000
MinSampleRate=8000.000000
CompressionQualityModifier=1.000000
AutoStreamingThreshold=0.000000
SoundCueCookQualityIndex=-1
[/Script/HardwareTargeting.HardwareTargetingSettings]
TargetedHardwareClass=Desktop
AppliedTargetedHardwareClass=Desktop
DefaultGraphicsPerformance=Maximum
AppliedDefaultGraphicsPerformance=Maximum
[/Script/Engine.RendererSettings]
r.GenerateMeshDistanceFields=True
r.DynamicGlobalIlluminationMethod=2
r.ReflectionMethod=2
r.Shadow.Virtual.Enable=1
r.DefaultFeature.AutoExposure.ExtendDefaultLuminanceRange=True
r.DefaultFeature.LocalExposure.HighlightContrastScale=0.8
r.DefaultFeature.LocalExposure.ShadowContrastScale=0.8
[/Script/WorldPartitionEditor.WorldPartitionEditorSettings]
CommandletClass=Class'/Script/UnrealEd.WorldPartitionConvertCommandlet'
[/Script/Engine.UserInterfaceSettings]
bAuthorizeAutomaticWidgetVariableCreation=False
FontDPIPreset=Standard
FontDPI=72
[/Script/Engine.Engine]
+ActiveGameNameRedirects=(OldGameName="TP_BlankBP",NewGameName="/Script/SpaceBattler")
+ActiveGameNameRedirects=(OldGameName="/Script/TP_BlankBP",NewGameName="/Script/SpaceBattler")
GameViewportClientClassName=/Script/CommonUI.CommonGameViewportClient
[/Script/AndroidFileServerEditor.AndroidFileServerRuntimeSettings]
bEnablePlugin=True
bAllowNetworkConnection=True
SecurityToken=6B81F1ED4A1C9319C8DF14A5CE133840
bIncludeInShipping=False
bAllowExternalStartInShipping=False
bCompileAFSProject=False
bUseCompression=False
bLogFiles=False
bReportStats=False
ConnectionType=USBOnly
bUseManualIPAddress=False
ManualIPAddress=

@ -0,0 +1,8 @@
[/Script/EngineSettings.GeneralProjectSettings]
ProjectID=48EAAE9D4AA343B35C083681A4525CF4
[/Script/CommonInput.CommonInputSettings]
InputData=/Game/Blueprints/UI/InputData.InputData_C

@ -0,0 +1,85 @@
[/Script/Engine.InputSettings]
-AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
-AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
-AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
+AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="Vive_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="MixedReality_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Left_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Grip_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trackpad_Force",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
bAltEnterTogglesFullscreen=True
bF11TogglesFullscreen=True
bUseMouseForTouch=False
bEnableMouseSmoothing=True
bEnableFOVScaling=True
bCaptureMouseOnLaunch=True
bEnableLegacyInputScales=True
bEnableMotionControls=True
bFilterInputByPlatformUser=False
bShouldFlushPressedKeysOnViewportFocusLost=True
bAlwaysShowTouchInterface=False
bShowConsoleOnFourFingerTap=True
bEnableGestureRecognizer=False
bUseAutocorrect=False
DefaultViewportMouseCaptureMode=CapturePermanently_IncludingInitialMouseDown
DefaultViewportMouseLockMode=LockOnCapture
FOVScale=0.011110
DoubleClickTime=0.200000
DefaultPlayerInputClass=/Script/EnhancedInput.EnhancedPlayerInput
DefaultInputComponentClass=/Script/EnhancedInput.EnhancedInputComponent
DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks
-ConsoleKeys=Tilde
+ConsoleKeys=Tilde
+ConsoleKeys=Caret

BIN
Content/Blueprints/BP_GameMode.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Blueprints/BP_GameState.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
Content/Blueprints/BP_PlayerPawn.uasset (Stored with Git LFS)

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.

Binary file not shown.

Binary file not shown.

BIN
Content/Blueprints/Loot/BP_Loot.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
Content/Blueprints/UI/BP_Grid.uasset (Stored with Git LFS)

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.

BIN
Content/Blueprints/UI/InputData.uasset (Stored with Git LFS)

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.

Binary file not shown.

Binary file not shown.

BIN
Content/Blueprints/UI/TextStyle.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Blueprints/UI/WBP_Grid.uasset (Stored with Git LFS)

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.

Binary file not shown.

BIN
Content/Levels/BattleMap.umap (Stored with Git LFS)

Binary file not shown.

BIN
Content/Levels/MainMenu.umap (Stored with Git LFS)

Binary file not shown.

BIN
Content/Models/Levels/Material.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Models/Levels/leveltest.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Content/UI/Text_Area.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/UI/button_hovered.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/UI/button_normal.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/UI/button_pressed.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/UI/column.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/UI/grid.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/UI/olney_light.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/UI/olney_light_Font.uasset (Stored with Git LFS)

Binary file not shown.

@ -0,0 +1,15 @@
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
using System.Collections.Generic;
public class SpaceBattlerTarget : TargetRules
{
public SpaceBattlerTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
DefaultBuildSettings = BuildSettingsVersion.V4;
ExtraModuleNames.AddRange( new string[] { "SpaceBattler" } );
}
}

@ -0,0 +1,13 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "Loot.h"
ULoot::ULoot()
{
}
void ULoot::Init_Implementation(AGameStateBase* GameState)
{
}

@ -0,0 +1,69 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "PartySubsystem.h"
void UPartySubsystem::AddToParty(UUnitInfo* UnitInfo)
{
for (TPair<UUnitInfo*, int32> &Unit : Members)
{
if(Unit.Key->GetClass() == UnitInfo->GetClass())
{
Unit.Value++;
return;
}
}
}
TMap<UUnitInfo*, int32> UPartySubsystem::GetMembers()
{
return Members;
}
int32 UPartySubsystem::SpawnParty(float InVerticalSpacing, float InHorizontalOffset, int InNumRows)
{
this->VerticalSpacing = InVerticalSpacing;
this->HorizontalOffset = InHorizontalOffset;
this->NumRows = InNumRows;
GetMembers().KeySort([](const UUnitInfo& A, const UUnitInfo& B)
{
return A.GetTier() < B.GetTier();
});
for (TPair<UUnitInfo*, int32> &Unit : GetMembers())
{
for(auto i = 0; i < Unit.Value; i++)
{
SpawnQueue.Add(Unit.Key->GetCharacterClass());
}
}
auto NumUnits= SpawnQueue.Num();
SpawnUnits();
GetWorld()->GetTimerManager().SetTimer(
SpawnTimerHandle,
this,
&UPartySubsystem::SpawnUnits,
0.5f,
true);
return NumUnits;
}
void UPartySubsystem::SpawnUnits()
{
for(auto i = 0; i < NumRows; i++)
{
if(i + LastSpawnIndex >= SpawnQueue.Num())
{
GetWorld()->GetTimerManager().ClearTimer(SpawnTimerHandle);
return;
}
FVector Location = FVector(VerticalSpacing * i - VerticalSpacing, -HorizontalOffset, 0);
GetWorld()->SpawnActor(SpawnQueue[i + LastSpawnIndex], &Location);
}
LastSpawnIndex += NumRows;
}

@ -0,0 +1,4 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "SBPlayerController.h"

@ -0,0 +1,65 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "StateMachineSubsystem.h"
void UStateMachineSubsystem::Initialize(FSubsystemCollectionBase& Collection)
{
Super::Initialize(Collection);
CurrentState = EGameState::MainMenu;
UE_LOG(LogTemp, Display, TEXT("Starting game state machine in MAINMENU state"))
}
bool UStateMachineSubsystem::ChangeState(EGameState NewState)
{
// Exit from old state
switch (CurrentState)
{
case EGameState::MainMenu:
switch(NewState)
{
case EGameState::Battle:
UE_LOG(LogTemp, Display, TEXT("Entering BATTLE state from MAINMENU"))
break;
default:
UE_LOG(LogTemp, Error, TEXT("NewState is invalid from MAINMENU state: %hhd"), NewState)
return false;
}
break;
case EGameState::Battle:
switch(NewState)
{
case EGameState::BattleMenu:
UE_LOG(LogTemp, Display, TEXT("Entering BATTLEMENU state from BATTLE"))
break;
case EGameState::GameOver:
UE_LOG(LogTemp, Display, TEXT("Entering GAMEOVER state from BATTLE"))
break;
case EGameState::Victory:
UE_LOG(LogTemp, Display, TEXT("Entering VICTORY state from BATTLE"))
break;
default:
UE_LOG(LogTemp, Error, TEXT("NewState is invalid from BATTLE state: %hhd"), NewState)
return false;
}
break;
case EGameState::BattleMenu:
switch(NewState)
{
case EGameState::Battle:
UE_LOG(LogTemp, Error, TEXT("Entering BATTLE state from BATTLEMENU"))
break;
default:
UE_LOG(LogTemp, Error, TEXT("NewState is invalid from BATTLEMENU state: %hhd"), NewState)
return false;
}
break;
default:
UE_LOG(LogTemp, Error, TEXT("Leaving unknown state, this is a problem"))
return false;
}
CurrentState = NewState;
StateChangedDelegate.Broadcast(NewState);
return true;
}

@ -0,0 +1,14 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "UnitInfo.h"
int32 UUnitInfo::GetTier() const
{
return Tier;
}
TSubclassOf<AActor> UUnitInfo::GetCharacterClass() const
{
return CharacterClass;
}

@ -0,0 +1,9 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "Wave.h"
TArray<UUnitInfo*> UWave::GetUnits()
{
return Units;
}

@ -0,0 +1,51 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "WaveSubsystem.h"
void UWaveSubsystem::Init(TArray<UWave*> InWaves, int32 CurrWave = 0)
{
CurrentWave = CurrWave;
Waves = InWaves;
}
int32 UWaveSubsystem::SpawnWave(float InVerticalSpacing, float InHorizontalOffset, int InNumRows)
{
NumRows = InNumRows;
HorizontalOffset = InHorizontalOffset;
VerticalSpacing = InVerticalSpacing;
SpawnQueue = Waves[CurrentWave]->GetUnits();
const auto NumUnits = SpawnQueue.Num();
SpawnUnits();
GetWorld()->GetTimerManager().SetTimer(
SpawnTimerHandle,
this,
&UWaveSubsystem::SpawnUnits,
0.5f,
true);
CurrentWave++;
return NumUnits;
}
void UWaveSubsystem::SpawnUnits()
{
for(auto i = 0; i < NumRows; i++)
{
if(i + LastSpawnIndex >= SpawnQueue.Num())
{
GetWorld()->GetTimerManager().ClearTimer(SpawnTimerHandle);
return;
}
FVector Location = FVector(VerticalSpacing * i - VerticalSpacing, HorizontalOffset, 0);
AActor* NewEnemy = GetWorld()->SpawnActor(SpawnQueue[i + LastSpawnIndex]->GetCharacterClass(), &Location);
if(NewEnemy != nullptr)
{
NewEnemy->Tags.Add(TEXT("enemy"));
}
}
LastSpawnIndex += NumRows;
}

@ -0,0 +1,26 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Loot.generated.h"
/**
*
*/
UCLASS(Blueprintable)
class SPACEBATTLER_API ULoot : public UObject
{
GENERATED_BODY()
public:
ULoot();
UFUNCTION(BlueprintCallable, Blueprintable, BlueprintNativeEvent)
void Init(AGameStateBase* GameState);
UPROPERTY(BlueprintReadWrite, EditAnywhere)
FText Name;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
FText Description;
};

@ -0,0 +1,44 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UnitInfo.h"
#include "Subsystems/LocalPlayerSubsystem.h"
#include "PartySubsystem.generated.h"
/**
*
*/
UCLASS()
class SPACEBATTLER_API UPartySubsystem : public ULocalPlayerSubsystem
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
int32 SpawnParty(float VerticalSpacing, float HorizontalOffset, int NumRows);
UFUNCTION(BlueprintCallable)
void AddToParty(UUnitInfo* UnitInfo);
UFUNCTION(BlueprintCallable)
TMap<UUnitInfo*, int32> GetMembers();
protected:
void SpawnUnits();
UPROPERTY()
TArray<TSubclassOf<AActor>> SpawnQueue;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
TMap<UUnitInfo*, int32> Members;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
UPrimaryDataAsset* SelectedGeneral;
FTimerHandle SpawnTimerHandle;
int32 LastSpawnIndex;
int32 NumRows;
float HorizontalOffset;
float VerticalSpacing;
};

@ -0,0 +1,16 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "SBPlayerController.generated.h"
/**
*
*/
UCLASS()
class SPACEBATTLER_API ASBPlayerController : public APlayerController
{
GENERATED_BODY()
};

@ -0,0 +1,39 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Subsystems/GameInstanceSubsystem.h"
#include "StateMachineSubsystem.generated.h"
UENUM(BlueprintType)
enum class EGameState : uint8
{
MainMenu,
Battle,
BattleMenu,
GameOver,
Victory
};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FStateChangedDelegate, EGameState, NewState);
/**
*
*/
UCLASS()
class SPACEBATTLER_API UStateMachineSubsystem : public UGameInstanceSubsystem
{
GENERATED_BODY()
public:
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
UFUNCTION(BlueprintCallable)
bool ChangeState(EGameState NewState);
UPROPERTY(BlueprintAssignable)
FStateChangedDelegate StateChangedDelegate;
protected:
EGameState CurrentState;
};

@ -0,0 +1,44 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataAsset.h"
#include "UnitInfo.generated.h"
/**
*
*/
UCLASS()
class SPACEBATTLER_API UUnitInfo : public UPrimaryDataAsset
{
GENERATED_BODY()
public:
int32 GetTier() const;
TSubclassOf<AActor> GetCharacterClass() const;
protected:
UPROPERTY(BlueprintReadWrite, EditAnywhere)
FText Name;
UPROPERTY(BlueprintReadWrite, EditAnywhere, meta = (MultiLine = true))
FText Description;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
float BaseHP;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
float Attack;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
float Cooldown;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
bool IsRanged;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
int32 Tier;
UPROPERTY(BlueprintReadWrite, EditAnywhere)
TSubclassOf<AActor> CharacterClass;
};

@ -0,0 +1,24 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UnitInfo.h"
#include "Engine/DataAsset.h"
#include "Wave.generated.h"
/**
*
*/
UCLASS()
class SPACEBATTLER_API UWave : public UPrimaryDataAsset
{
GENERATED_BODY()
public:
TArray<UUnitInfo*> GetUnits();
protected:
UPROPERTY(BlueprintReadWrite, EditAnywhere)
TArray<UUnitInfo*> Units;
};

@ -0,0 +1,41 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Wave.h"
#include "Subsystems/GameInstanceSubsystem.h"
#include "WaveSubsystem.generated.h"
/**
*
*/
UCLASS()
class SPACEBATTLER_API UWaveSubsystem : public UGameInstanceSubsystem
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
void Init(TArray<UWave*> InWaves, int32 CurrWave);
UFUNCTION(BlueprintCallable)
int32 SpawnWave(float InVerticalSpacing, float InHorizontalOffset, int InNumRows);
protected:
void SpawnUnits();
UPROPERTY()
TArray<UWave*> Waves;
UPROPERTY(BlueprintReadOnly)
int32 CurrentWave;
UPROPERTY()
TArray<UUnitInfo*> SpawnQueue;
FTimerHandle SpawnTimerHandle;
int32 NumRows;
int32 LastSpawnIndex;
float VerticalSpacing;
float HorizontalOffset;
};

@ -0,0 +1,23 @@
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
public class SpaceBattler : ModuleRules
{
public SpaceBattler(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
PrivateDependencyModuleNames.AddRange(new string[] { });
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
}

@ -0,0 +1,6 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "SpaceBattler.h"
#include "Modules/ModuleManager.h"
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, SpaceBattler, "SpaceBattler" );

@ -0,0 +1,6 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"

@ -0,0 +1,15 @@
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
using System.Collections.Generic;
public class SpaceBattlerEditorTarget : TargetRules
{
public SpaceBattlerEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
DefaultBuildSettings = BuildSettingsVersion.V4;
ExtraModuleNames.AddRange( new string[] { "SpaceBattler" } );
}
}

@ -0,0 +1,29 @@
{
"FileVersion": 3,
"EngineAssociation": "5.3",
"Category": "",
"Description": "",
"Modules": [
{
"Name": "SpaceBattler",
"Type": "Runtime",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"Engine"
]
}
],
"Plugins": [
{
"Name": "ModelingToolsEditorMode",
"Enabled": true,
"TargetAllowList": [
"Editor"
]
},
{
"Name": "CommonUI",
"Enabled": true
}
]
}
Loading…
Cancel
Save