Add ammo drops from dead enemies
This commit is contained in:
parent
88db9deea4
commit
27edeb0f0c
@ -0,0 +1 @@
|
|||||||
|
|
@ -49,6 +49,7 @@ bUseSplitscreen=False
|
|||||||
+Profiles=(Name="Ragdoll",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="PhysicsBody",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore)),HelpMessage="Simulating Skeletal Mesh Component. All other channels will be set to default.")
|
+Profiles=(Name="Ragdoll",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="PhysicsBody",CustomResponses=((Channel="Pawn",Response=ECR_Ignore),(Channel="Visibility",Response=ECR_Ignore)),HelpMessage="Simulating Skeletal Mesh Component. All other channels will be set to default.")
|
||||||
+Profiles=(Name="Vehicle",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="Vehicle",CustomResponses=,HelpMessage="Vehicle object that blocks Vehicle, WorldStatic, and WorldDynamic. All other channels will be set to default.")
|
+Profiles=(Name="Vehicle",CollisionEnabled=QueryAndPhysics,bCanModify=False,ObjectTypeName="Vehicle",CustomResponses=,HelpMessage="Vehicle object that blocks Vehicle, WorldStatic, and WorldDynamic. All other channels will be set to default.")
|
||||||
+Profiles=(Name="UI",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility"),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ")
|
+Profiles=(Name="UI",CollisionEnabled=QueryOnly,bCanModify=False,ObjectTypeName="WorldDynamic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility"),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap)),HelpMessage="WorldStatic object that overlaps all actors by default. All new custom channels will use its own default response. ")
|
||||||
|
+Profiles=(Name="Pickup",CollisionEnabled=QueryAndPhysics,bCanModify=True,ObjectTypeName="WorldStatic",CustomResponses=((Channel="WorldStatic",Response=ECR_Overlap),(Channel="WorldDynamic",Response=ECR_Overlap),(Channel="Pawn",Response=ECR_Overlap),(Channel="Visibility",Response=ECR_Overlap),(Channel="Camera",Response=ECR_Overlap),(Channel="PhysicsBody",Response=ECR_Overlap),(Channel="Vehicle",Response=ECR_Overlap),(Channel="Destructible",Response=ECR_Overlap),(Channel="Character",Response=ECR_Overlap)),HelpMessage="Item to pickup")
|
||||||
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="Character")
|
+DefaultChannelResponses=(Channel=ECC_GameTraceChannel1,DefaultResponse=ECR_Block,bTraceType=False,bStaticObject=False,Name="Character")
|
||||||
-ProfileRedirects=(OldName="BlockingVolume",NewName="InvisibleWall")
|
-ProfileRedirects=(OldName="BlockingVolume",NewName="InvisibleWall")
|
||||||
-ProfileRedirects=(OldName="InterpActor",NewName="IgnoreOnlyPawn")
|
-ProfileRedirects=(OldName="InterpActor",NewName="IgnoreOnlyPawn")
|
||||||
|
BIN
Content/AmmoPickup.uasset
Executable file
BIN
Content/AmmoPickup.uasset
Executable file
Binary file not shown.
Binary file not shown.
BIN
Content/EnemyPawn_BP.uasset
Executable file
BIN
Content/EnemyPawn_BP.uasset
Executable 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.
@ -7,9 +7,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Engine", "Engine", "{94A6C6
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Games", "Games", "{8E2F6A87-1826-34F4-940C-CC23A48F9FE4}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Games", "Games", "{8E2F6A87-1826-34F4-940C-CC23A48F9FE4}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PresidentsBrigade", "Intermediate\ProjectFiles\PresidentsBrigade.vcxproj", "{96B177F0-8EDF-4729-A78F-BAD24CB85C00}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PresidentsBrigade", "Intermediate\ProjectFiles\PresidentsBrigade.vcxproj", "{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UE4", "Intermediate\ProjectFiles\UE4.vcxproj", "{79A8FA76-49BB-457C-B380-F831AAAAD3DE}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UE4", "Intermediate\ProjectFiles\UE4.vcxproj", "{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Visualizers", "Visualizers", "{1CCEC849-CC72-4C59-8C36-2F7C38706D4C}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Visualizers", "Visualizers", "{1CCEC849-CC72-4C59-8C36-2F7C38706D4C}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
@ -35,53 +35,53 @@ Global
|
|||||||
Shipping|Win64 = Shipping|Win64
|
Shipping|Win64 = Shipping|Win64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame Editor|Android.ActiveCfg = Invalid|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.DebugGame Editor|Android.ActiveCfg = Invalid|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame Editor|Win32.ActiveCfg = Invalid|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.DebugGame Editor|Win32.ActiveCfg = Invalid|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame Editor|Win64.ActiveCfg = DebugGame_Editor|x64
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.DebugGame Editor|Win64.ActiveCfg = DebugGame_Editor|x64
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame Editor|Win64.Build.0 = DebugGame_Editor|x64
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.DebugGame Editor|Win64.Build.0 = DebugGame_Editor|x64
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Android.ActiveCfg = Android_DebugGame|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.DebugGame|Android.ActiveCfg = Android_DebugGame|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Android.Build.0 = Android_DebugGame|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.DebugGame|Android.Build.0 = Android_DebugGame|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Win32.ActiveCfg = DebugGame|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.DebugGame|Win32.ActiveCfg = DebugGame|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Win32.Build.0 = DebugGame|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.DebugGame|Win32.Build.0 = DebugGame|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Win64.ActiveCfg = DebugGame|x64
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.DebugGame|Win64.ActiveCfg = DebugGame|x64
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.DebugGame|Win64.Build.0 = DebugGame|x64
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.DebugGame|Win64.Build.0 = DebugGame|x64
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development Editor|Android.ActiveCfg = Invalid|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Development Editor|Android.ActiveCfg = Invalid|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development Editor|Win32.ActiveCfg = Invalid|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Development Editor|Win32.ActiveCfg = Invalid|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development Editor|Win64.ActiveCfg = Development_Editor|x64
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Development Editor|Win64.ActiveCfg = Development_Editor|x64
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development Editor|Win64.Build.0 = Development_Editor|x64
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Development Editor|Win64.Build.0 = Development_Editor|x64
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Android.ActiveCfg = Android_Development|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Development|Android.ActiveCfg = Android_Development|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Android.Build.0 = Android_Development|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Development|Android.Build.0 = Android_Development|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Win32.ActiveCfg = Development|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Development|Win32.ActiveCfg = Development|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Win32.Build.0 = Development|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Development|Win32.Build.0 = Development|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Win64.ActiveCfg = Development|x64
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Development|Win64.ActiveCfg = Development|x64
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Development|Win64.Build.0 = Development|x64
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Development|Win64.Build.0 = Development|x64
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Android.ActiveCfg = Android_Shipping|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Shipping|Android.ActiveCfg = Android_Shipping|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Android.Build.0 = Android_Shipping|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Shipping|Android.Build.0 = Android_Shipping|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Win32.ActiveCfg = Shipping|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Shipping|Win32.ActiveCfg = Shipping|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Win32.Build.0 = Shipping|Win32
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Shipping|Win32.Build.0 = Shipping|Win32
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Win64.ActiveCfg = Shipping|x64
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Shipping|Win64.ActiveCfg = Shipping|x64
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00}.Shipping|Win64.Build.0 = Shipping|x64
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444}.Shipping|Win64.Build.0 = Shipping|x64
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.DebugGame Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame Editor|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.DebugGame Editor|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.DebugGame Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.DebugGame|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.DebugGame|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.DebugGame|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.DebugGame|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.Development Editor|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development Editor|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.Development Editor|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.Development Editor|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.Development|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.Development|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Development|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.Development|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Shipping|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.Shipping|Android.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Shipping|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.Shipping|Win32.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE}.Shipping|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D}.Shipping|Win64.ActiveCfg = BuiltWithUnrealBuildTool|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{79A8FA76-49BB-457C-B380-F831AAAAD3DE} = {94A6C6F3-99B3-346E-9557-ABF9D4064DBD}
|
{1FED94F2-9FEC-4D92-9CAE-368909B2BF8D} = {94A6C6F3-99B3-346E-9557-ABF9D4064DBD}
|
||||||
{96B177F0-8EDF-4729-A78F-BAD24CB85C00} = {8E2F6A87-1826-34F4-940C-CC23A48F9FE4}
|
{F7E08F87-96C6-4EFA-AB4B-FFF8D73E1444} = {8E2F6A87-1826-34F4-940C-CC23A48F9FE4}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@ -34,6 +34,7 @@ ABasePawn::ABasePawn(const FObjectInitializer &object_initializer):
|
|||||||
|
|
||||||
// Set defaults.
|
// Set defaults.
|
||||||
max_health = 100;
|
max_health = 100;
|
||||||
|
max_ammo = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the game starts or when spawned
|
// Called when the game starts or when spawned
|
||||||
@ -51,6 +52,7 @@ void ABasePawn::BeginPlay()
|
|||||||
* Set base state.
|
* Set base state.
|
||||||
*/
|
*/
|
||||||
current_health = max_health;
|
current_health = max_health;
|
||||||
|
current_ammo = max_ammo;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABasePawn::handle_hit(
|
void ABasePawn::handle_hit(
|
||||||
@ -143,25 +145,28 @@ void ABasePawn::stop_shooting()
|
|||||||
|
|
||||||
void ABasePawn::shoot()
|
void ABasePawn::shoot()
|
||||||
{
|
{
|
||||||
FVector player_location = player_mesh->GetComponentLocation();
|
if (current_ammo > 0)
|
||||||
const float y = yaw.calculate_yaw();
|
{
|
||||||
LogInfo(FString::Printf(TEXT("Raw yaw: %f"), y));
|
FVector player_location = player_mesh->GetComponentLocation();
|
||||||
const FRotator rotator(0, y, 0);
|
const float y = yaw.calculate_yaw();
|
||||||
FVector forward = FRotationMatrix(rotator).GetUnitAxis(EAxis::X) * 100;
|
const FRotator rotator(0, y, 0);
|
||||||
|
FVector forward = FRotationMatrix(rotator).GetUnitAxis(EAxis::X) * 100;
|
||||||
|
|
||||||
FVector spawn_location = player_location + forward;
|
FVector spawn_location = player_location + forward;
|
||||||
FActorSpawnParameters spawnParameters;
|
FActorSpawnParameters spawnParameters;
|
||||||
spawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
spawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
spawnParameters.Owner = this;
|
spawnParameters.Owner = this;
|
||||||
spawnParameters.Instigator = this;
|
spawnParameters.Instigator = this;
|
||||||
AActor* bullet = GetWorld()->SpawnActor<AActor>(
|
AActor* bullet = GetWorld()->SpawnActor<AActor>(
|
||||||
bullet_actor_class,
|
bullet_actor_class,
|
||||||
spawn_location,
|
spawn_location,
|
||||||
rotator,
|
rotator,
|
||||||
spawnParameters
|
spawnParameters
|
||||||
);
|
);
|
||||||
|
|
||||||
shoot_time_elapsed = 0;
|
shoot_time_elapsed = 0;
|
||||||
|
current_ammo -= 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABasePawn::handle_death()
|
void ABasePawn::handle_death()
|
||||||
|
@ -68,7 +68,7 @@ protected:
|
|||||||
UPROPERTY(EditAnywhere, Category="Player")
|
UPROPERTY(EditAnywhere, Category="Player")
|
||||||
UBoxComponent* collision;
|
UBoxComponent* collision;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadWrite, Category="Player")
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Player")
|
||||||
UStaticMeshComponent* player_mesh;
|
UStaticMeshComponent* player_mesh;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, Category="Movement")
|
UPROPERTY(EditAnywhere, Category="Movement")
|
||||||
@ -105,9 +105,18 @@ protected:
|
|||||||
UPROPERTY(EditAnywhere, Category = "Attack")
|
UPROPERTY(EditAnywhere, Category = "Attack")
|
||||||
int32 max_health;
|
int32 max_health;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bullet fire rate.
|
||||||
|
*/
|
||||||
UPROPERTY(EditAnywhere, Category = "Attack")
|
UPROPERTY(EditAnywhere, Category = "Attack")
|
||||||
float fire_rate_s;
|
float fire_rate_s;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Max ammor.
|
||||||
|
*/
|
||||||
|
UPROPERTY(EditAnywhere, Category = "Attack")
|
||||||
|
int32 max_ammo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shooting enabled;
|
* Shooting enabled;
|
||||||
*/
|
*/
|
||||||
@ -123,6 +132,11 @@ protected:
|
|||||||
*/
|
*/
|
||||||
int32 current_health;
|
int32 current_health;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Current ammo.
|
||||||
|
*/
|
||||||
|
int32 current_ammo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last yaw.
|
* Last yaw.
|
||||||
*/
|
*/
|
||||||
|
35
Source/PresidentsBrigade/EnemyPawn.cpp
Executable file
35
Source/PresidentsBrigade/EnemyPawn.cpp
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "EnemyPawn.h"
|
||||||
|
#include "Pickup.h"
|
||||||
|
|
||||||
|
void AEnemyPawn::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize random stream.
|
||||||
|
*/
|
||||||
|
random.Initialize(FMath::Rand());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AEnemyPawn::destroy_self()
|
||||||
|
{
|
||||||
|
const bool drop_pickup = random.GetFraction() > .5;
|
||||||
|
|
||||||
|
if (drop_pickup)
|
||||||
|
{
|
||||||
|
FVector location = get_location() + FVector(100, 100, 0);
|
||||||
|
FActorSpawnParameters spawnParameters;
|
||||||
|
spawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||||
|
APickup* pickup = GetWorld()->SpawnActor<APickup>(
|
||||||
|
pickup_class,
|
||||||
|
location,
|
||||||
|
FRotator(0,0,0),
|
||||||
|
spawnParameters
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
ABasePawn::destroy_self();
|
||||||
|
}
|
33
Source/PresidentsBrigade/EnemyPawn.h
Executable file
33
Source/PresidentsBrigade/EnemyPawn.h
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "BasePawn.h"
|
||||||
|
#include "EnemyPawn.generated.h"
|
||||||
|
|
||||||
|
class APickup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UCLASS()
|
||||||
|
class PRESIDENTSBRIGADE_API AEnemyPawn : public ABasePawn
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
protected:
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
virtual void destroy_self() override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pickup class to spawn on death.
|
||||||
|
*/
|
||||||
|
UPROPERTY(EditAnywhere, Category = "Player")
|
||||||
|
TSubclassOf<class APickup> pickup_class;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* Random number stream.
|
||||||
|
*/
|
||||||
|
FRandomStream random;
|
||||||
|
};
|
35
Source/PresidentsBrigade/Pickup.cpp
Executable file
35
Source/PresidentsBrigade/Pickup.cpp
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "Pickup.h"
|
||||||
|
#include "Components/BoxComponent.h"
|
||||||
|
|
||||||
|
// Sets default values
|
||||||
|
APickup::APickup(const FObjectInitializer &object_initializer)
|
||||||
|
{
|
||||||
|
collision = object_initializer.CreateDefaultSubobject<UBoxComponent>(this, FName("Collision"));
|
||||||
|
RootComponent = collision;
|
||||||
|
collision->SetCollisionProfileName(FName("Pickup"));
|
||||||
|
|
||||||
|
mesh = object_initializer.CreateDefaultSubobject<UStaticMeshComponent>(this, FName("Mesh"));
|
||||||
|
mesh->SetupAttachment(RootComponent);
|
||||||
|
mesh->SetCollisionEnabled(ECollisionEnabled::NoCollision);
|
||||||
|
|
||||||
|
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
|
||||||
|
PrimaryActorTick.bCanEverTick = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the game starts or when spawned
|
||||||
|
void APickup::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called every frame
|
||||||
|
void APickup::Tick(float DeltaTime)
|
||||||
|
{
|
||||||
|
Super::Tick(DeltaTime);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
31
Source/PresidentsBrigade/Pickup.h
Executable file
31
Source/PresidentsBrigade/Pickup.h
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "CoreMinimal.h"
|
||||||
|
#include "GameFramework/Actor.h"
|
||||||
|
#include "Pickup.generated.h"
|
||||||
|
|
||||||
|
class UBoxComponent;
|
||||||
|
|
||||||
|
UCLASS()
|
||||||
|
class PRESIDENTSBRIGADE_API APickup : public AActor
|
||||||
|
{
|
||||||
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Sets default values for this actor's properties
|
||||||
|
APickup(const FObjectInitializer &object_initializer);
|
||||||
|
|
||||||
|
// Called every frame
|
||||||
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
protected:
|
||||||
|
// Called when the game starts or when spawned
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, Category="Pickup")
|
||||||
|
UBoxComponent* collision;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, Category="Pickup")
|
||||||
|
UStaticMeshComponent* mesh;
|
||||||
|
};
|
@ -7,6 +7,7 @@
|
|||||||
#include "Math/UnrealMathUtility.h"
|
#include "Math/UnrealMathUtility.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
|
#define LogInfo(Msg) Util::log_info(TEXT("APlayerPawn"), Msg)
|
||||||
#define LogError(Msg) Util::log_error(TEXT("APlayerPawn"), Msg)
|
#define LogError(Msg) Util::log_error(TEXT("APlayerPawn"), Msg)
|
||||||
|
|
||||||
APlayerPawn::APlayerPawn(const FObjectInitializer &object_initializer):
|
APlayerPawn::APlayerPawn(const FObjectInitializer &object_initializer):
|
||||||
@ -38,6 +39,39 @@ void APlayerPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponen
|
|||||||
PlayerInputComponent->BindAction("Boost", EInputEvent::IE_Released, this, &APlayerPawn::reset_boost);
|
PlayerInputComponent->BindAction("Boost", EInputEvent::IE_Released, this, &APlayerPawn::reset_boost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void APlayerPawn::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Setup collision handler.
|
||||||
|
*/
|
||||||
|
collision->OnComponentBeginOverlap.AddDynamic(this, &APlayerPawn::handle_overlap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void APlayerPawn::handle_overlap(
|
||||||
|
UPrimitiveComponent *overlapped_component,
|
||||||
|
AActor *other_actor,
|
||||||
|
UPrimitiveComponent *other_component,
|
||||||
|
int32 other_body_index,
|
||||||
|
bool from_sweep,
|
||||||
|
const FHitResult& hit)
|
||||||
|
{
|
||||||
|
UClass* other_class = other_actor->GetClass();
|
||||||
|
if (ammo_class_map.Contains(other_class))
|
||||||
|
{
|
||||||
|
// Update current ammo.
|
||||||
|
current_ammo += ammo_class_map[other_class];
|
||||||
|
if (current_ammo > max_ammo)
|
||||||
|
{
|
||||||
|
current_ammo = max_ammo;
|
||||||
|
}
|
||||||
|
|
||||||
|
other_actor->Destroy();
|
||||||
|
LogInfo(FString::Printf(TEXT("Total ammo %d"), current_ammo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void APlayerPawn::Tick(float delta_time)
|
void APlayerPawn::Tick(float delta_time)
|
||||||
{
|
{
|
||||||
Super::Tick(delta_time);
|
Super::Tick(delta_time);
|
||||||
|
@ -24,6 +24,7 @@ public:
|
|||||||
// Called to bind functionality to input
|
// Called to bind functionality to input
|
||||||
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
||||||
protected:
|
protected:
|
||||||
|
virtual void BeginPlay() override;
|
||||||
virtual void destroy_self() override;
|
virtual void destroy_self() override;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, Category="Player")
|
UPROPERTY(EditAnywhere, Category="Player")
|
||||||
@ -35,6 +36,12 @@ protected:
|
|||||||
UPROPERTY(EditAnywhere, Category = "Player")
|
UPROPERTY(EditAnywhere, Category = "Player")
|
||||||
float respawn_s;
|
float respawn_s;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classes that can add ammo to this object.
|
||||||
|
*/
|
||||||
|
UPROPERTY(EditAnywhere, Category = "Player")
|
||||||
|
TMap<UClass*, int> ammo_class_map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Multiplier to apply to current speed while boosting. Applies to max speed and accleration.
|
* Multiplier to apply to current speed while boosting. Applies to max speed and accleration.
|
||||||
*/
|
*/
|
||||||
@ -54,6 +61,16 @@ protected:
|
|||||||
float cooldown_threshold_s;
|
float cooldown_threshold_s;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
UFUNCTION()
|
||||||
|
void handle_overlap(
|
||||||
|
UPrimitiveComponent *overlapped_component,
|
||||||
|
AActor *other_actor,
|
||||||
|
UPrimitiveComponent *other_component,
|
||||||
|
int32 other_body_index,
|
||||||
|
bool from_sweep,
|
||||||
|
const FHitResult& hit
|
||||||
|
);
|
||||||
|
|
||||||
void boost();
|
void boost();
|
||||||
void reset_boost();
|
void reset_boost();
|
||||||
void respawn();
|
void respawn();
|
||||||
|
6
todo.txt
6
todo.txt
@ -13,15 +13,14 @@ xAdd dash
|
|||||||
xShoot from any direction
|
xShoot from any direction
|
||||||
xShoot at continuous rate when holding shoot button
|
xShoot at continuous rate when holding shoot button
|
||||||
xAdd player damage
|
xAdd player damage
|
||||||
Add player ammo
|
xAdd player ammo
|
||||||
Add HUD UI
|
|
||||||
Add win condition
|
Add win condition
|
||||||
- Time based. Keep president alive until he reaches destination.
|
- Time based. Keep president alive until he reaches destination.
|
||||||
|
Add HUD UI
|
||||||
Add menu
|
Add menu
|
||||||
Add local multiplayer
|
Add local multiplayer
|
||||||
x Blueprint
|
x Blueprint
|
||||||
- C++
|
- C++
|
||||||
Add netcode
|
|
||||||
Add art
|
Add art
|
||||||
- Car models
|
- Car models
|
||||||
- Street shader
|
- Street shader
|
||||||
@ -29,3 +28,4 @@ Add sounds
|
|||||||
Add juice
|
Add juice
|
||||||
Add muzzle on shoot
|
Add muzzle on shoot
|
||||||
Camera zoom out based on screen size? Looks too small when I shrink the window
|
Camera zoom out based on screen size? Looks too small when I shrink the window
|
||||||
|
Add netcode
|
||||||
|
Loading…
Reference in New Issue
Block a user