diff --git a/Content/PlayerPawn_BP.uasset b/Content/PlayerPawn_BP.uasset index b3003fb..346dde7 100755 Binary files a/Content/PlayerPawn_BP.uasset and b/Content/PlayerPawn_BP.uasset differ diff --git a/PresidentsBrigade.sln b/PresidentsBrigade.sln index 9e27c43..954887a 100755 --- a/PresidentsBrigade.sln +++ b/PresidentsBrigade.sln @@ -7,9 +7,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Engine", "Engine", "{94A6C6 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Games", "Games", "{8E2F6A87-1826-34F4-940C-CC23A48F9FE4}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PresidentsBrigade", "Intermediate\ProjectFiles\PresidentsBrigade.vcxproj", "{97946AF8-2BBD-45DF-B560-04E9007DCB1A}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PresidentsBrigade", "Intermediate\ProjectFiles\PresidentsBrigade.vcxproj", "{96B177F0-8EDF-4729-A78F-BAD24CB85C00}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UE4", "Intermediate\ProjectFiles\UE4.vcxproj", "{7B9D3087-59A5-43EF-B77B-4DBA855467B6}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UE4", "Intermediate\ProjectFiles\UE4.vcxproj", "{79A8FA76-49BB-457C-B380-F831AAAAD3DE}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Visualizers", "Visualizers", "{1CCEC849-CC72-4C59-8C36-2F7C38706D4C}" ProjectSection(SolutionItems) = preProject @@ -35,53 +35,53 @@ Global Shipping|Win64 = Shipping|Win64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame Editor|Android.ActiveCfg = Invalid|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame Editor|Win32.ActiveCfg = Invalid|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame Editor|Win64.ActiveCfg = DebugGame_Editor|x64 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame Editor|Win64.Build.0 = DebugGame_Editor|x64 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame|Android.ActiveCfg = Android_DebugGame|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame|Android.Build.0 = Android_DebugGame|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame|Win32.ActiveCfg = DebugGame|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame|Win32.Build.0 = DebugGame|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame|Win64.ActiveCfg = DebugGame|x64 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.DebugGame|Win64.Build.0 = DebugGame|x64 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development Editor|Android.ActiveCfg = Invalid|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development Editor|Win32.ActiveCfg = Invalid|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development Editor|Win64.ActiveCfg = Development_Editor|x64 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development Editor|Win64.Build.0 = Development_Editor|x64 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development|Android.ActiveCfg = Android_Development|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development|Android.Build.0 = Android_Development|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development|Win32.ActiveCfg = Development|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development|Win32.Build.0 = Development|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development|Win64.ActiveCfg = Development|x64 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Development|Win64.Build.0 = Development|x64 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Shipping|Android.ActiveCfg = Android_Shipping|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Shipping|Android.Build.0 = Android_Shipping|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Shipping|Win32.ActiveCfg = Shipping|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Shipping|Win32.Build.0 = Shipping|Win32 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Shipping|Win64.ActiveCfg = Shipping|x64 - {97946AF8-2BBD-45DF-B560-04E9007DCB1A}.Shipping|Win64.Build.0 = Shipping|x64 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.DebugGame Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.DebugGame Editor|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.DebugGame Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.DebugGame|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.DebugGame|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.DebugGame|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Development Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Development Editor|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Development Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Development|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Development|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Development|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Shipping|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Shipping|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32 - {7B9D3087-59A5-43EF-B77B-4DBA855467B6}.Shipping|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame Editor|Android.ActiveCfg = Invalid|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame Editor|Win32.ActiveCfg = Invalid|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame Editor|Win64.ActiveCfg = DebugGame_Editor|x64 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame Editor|Win64.Build.0 = DebugGame_Editor|x64 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Android.ActiveCfg = Android_DebugGame|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Android.Build.0 = Android_DebugGame|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Win32.ActiveCfg = DebugGame|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Win32.Build.0 = DebugGame|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Win64.ActiveCfg = DebugGame|x64 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Win64.Build.0 = DebugGame|x64 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development Editor|Android.ActiveCfg = Invalid|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development Editor|Win32.ActiveCfg = Invalid|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development Editor|Win64.ActiveCfg = Development_Editor|x64 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development Editor|Win64.Build.0 = Development_Editor|x64 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Android.ActiveCfg = Android_Development|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Android.Build.0 = Android_Development|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Win32.ActiveCfg = Development|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Win32.Build.0 = Development|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Win64.ActiveCfg = Development|x64 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Win64.Build.0 = Development|x64 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Android.ActiveCfg = Android_Shipping|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Android.Build.0 = Android_Shipping|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Win32.ActiveCfg = Shipping|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Win32.Build.0 = Shipping|Win32 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Win64.ActiveCfg = Shipping|x64 + {96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Win64.Build.0 = Shipping|x64 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame Editor|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development Editor|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Shipping|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Shipping|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32 + {79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Shipping|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {7B9D3087-59A5-43EF-B77B-4DBA855467B6} = {94A6C6F3-99B3-346E-9557-ABF9D4064DBD} - {97946AF8-2BBD-45DF-B560-04E9007DCB1A} = {8E2F6A87-1826-34F4-940C-CC23A48F9FE4} + {79A8FA76-49BB-457C-B380-F831AAAAD3DE} = {94A6C6F3-99B3-346E-9557-ABF9D4064DBD} + {96B177F0-8EDF-4729-A78F-BAD24CB85C00} = {8E2F6A87-1826-34F4-940C-CC23A48F9FE4} EndGlobalSection EndGlobal diff --git a/Source/PresidentsBrigade/BasePawn.cpp b/Source/PresidentsBrigade/BasePawn.cpp index 032b0ea..7f8d42f 100755 --- a/Source/PresidentsBrigade/BasePawn.cpp +++ b/Source/PresidentsBrigade/BasePawn.cpp @@ -85,6 +85,15 @@ void ABasePawn::Tick(float DeltaTime) { Super::Tick(DeltaTime); + /* + * Auto-fire. + */ + shoot_time_elapsed += DeltaTime; + if (shooting_enabled && shoot_time_elapsed > fire_rate_s) + { + shoot(); + } + /* * Handle death. */ @@ -122,6 +131,17 @@ void ABasePawn::update_yaw_y(float y_component) yaw.y_component = y_component; } +void ABasePawn::start_shooting() +{ + shooting_enabled = true; + shoot(); +} + +void ABasePawn::stop_shooting() +{ + shooting_enabled = false; +} + void ABasePawn::shoot() { FVector player_location = player_mesh->GetComponentLocation(); @@ -141,6 +161,8 @@ void ABasePawn::shoot() rotator, spawnParameters ); + + shoot_time_elapsed = 0; } void ABasePawn::handle_death() diff --git a/Source/PresidentsBrigade/BasePawn.h b/Source/PresidentsBrigade/BasePawn.h index 7656888..1ff7a8d 100755 --- a/Source/PresidentsBrigade/BasePawn.h +++ b/Source/PresidentsBrigade/BasePawn.h @@ -27,6 +27,8 @@ public: virtual void handle_move_forward(float axis); virtual void update_yaw_x(float x_component); virtual void update_yaw_y(float y_component); + virtual void start_shooting(); + virtual void stop_shooting(); virtual void shoot(); virtual void handle_death(); protected: @@ -101,6 +103,19 @@ protected: UPROPERTY(EditAnywhere, Category = "Attack") int32 max_health; + UPROPERTY(EditAnywhere, Category = "Attack") + float fire_rate_s; + + /** + * Shooting enabled; + */ + bool shooting_enabled; + + /** + * Time elapsed since last shot. + */ + float shoot_time_elapsed; + /** * Current health for character. */ diff --git a/Source/PresidentsBrigade/PlayerPawn.cpp b/Source/PresidentsBrigade/PlayerPawn.cpp index ffc7499..2d93307 100755 --- a/Source/PresidentsBrigade/PlayerPawn.cpp +++ b/Source/PresidentsBrigade/PlayerPawn.cpp @@ -32,7 +32,8 @@ void APlayerPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen PlayerInputComponent->BindAxis("MoveRight", this, &ABasePawn::handle_move_right); PlayerInputComponent->BindAxis("YawXUpdate", this, &ABasePawn::update_yaw_x); PlayerInputComponent->BindAxis("YawYUpdate", this, &ABasePawn::update_yaw_y); - PlayerInputComponent->BindAction("Shoot", EInputEvent::IE_Pressed, this, &ABasePawn::shoot); + PlayerInputComponent->BindAction("Shoot", EInputEvent::IE_Pressed, this, &ABasePawn::start_shooting); + PlayerInputComponent->BindAction("Shoot", EInputEvent::IE_Released, this, &ABasePawn::stop_shooting); PlayerInputComponent->BindAction("Boost", EInputEvent::IE_Pressed, this, &APlayerPawn::boost); PlayerInputComponent->BindAction("Boost", EInputEvent::IE_Released, this, &APlayerPawn::reset_boost); } diff --git a/todo.txt b/todo.txt index ce1aa9e..da619ce 100644 --- a/todo.txt +++ b/todo.txt @@ -11,7 +11,7 @@ xAdd enemy cars xAttacks president car xAdd dash xShoot from any direction -Shoot at continuous rate when holding shoot button +xShoot at continuous rate when holding shoot button Add local multiplayer Add netcode Add player damage