diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..fbec8216 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,91 @@ +[*.{cpp,h}] + +# Naming convention rules (note: currently need to be ordered from more to less specific) + +cpp_naming_rule.aactor_prefixed.symbols = aactor_class +cpp_naming_rule.aactor_prefixed.style = aactor_style + +cpp_naming_rule.swidget_prefixed.symbols = swidget_class +cpp_naming_rule.swidget_prefixed.style = swidget_style + +cpp_naming_rule.uobject_prefixed.symbols = uobject_class +cpp_naming_rule.uobject_prefixed.style = uobject_style + +cpp_naming_rule.booleans_prefixed.symbols = boolean_vars +cpp_naming_rule.booleans_prefixed.style = boolean_style + +cpp_naming_rule.structs_prefixed.symbols = structs +cpp_naming_rule.structs_prefixed.style = unreal_engine_structs + +cpp_naming_rule.enums_prefixed.symbols = enums +cpp_naming_rule.enums_prefixed.style = unreal_engine_enums + +cpp_naming_rule.templates_prefixed.symbols = templates +cpp_naming_rule.templates_prefixed.style = unreal_engine_templates + +cpp_naming_rule.general_names.symbols = all_symbols +cpp_naming_rule.general_names.style = unreal_engine_default + +# Naming convention symbols + +cpp_naming_symbols.aactor_class.applicable_kinds = class +cpp_naming_symbols.aactor_class.applicable_type = AActor + +cpp_naming_symbols.swidget_class.applicable_kinds = class +cpp_naming_symbols.swidget_class.applicable_type = SWidget + +cpp_naming_symbols.uobject_class.applicable_kinds = class +cpp_naming_symbols.uobject_class.applicable_type = UObject + +cpp_naming_symbols.boolean_vars.applicable_kinds = local,parameter,field +cpp_naming_symbols.boolean_vars.applicable_type = bool + +cpp_naming_symbols.enums.applicable_kinds = enum + +cpp_naming_symbols.templates.applicable_kinds = template_class + +cpp_naming_symbols.structs.applicable_kinds = struct + +cpp_naming_symbols.all_symbols.applicable_kinds = * + +# Naming convention styles + +cpp_naming_style.unreal_engine_default.capitalization = pascal_case +cpp_naming_style.unreal_engine_default.required_prefix = +cpp_naming_style.unreal_engine_default.required_suffix = +cpp_naming_style.unreal_engine_default.word_separator = + +cpp_naming_style.unreal_engine_enums.capitalization = pascal_case +cpp_naming_style.unreal_engine_enums.required_prefix = E +cpp_naming_style.unreal_engine_enums.required_suffix = +cpp_naming_style.unreal_engine_enums.word_separator = + +cpp_naming_style.unreal_engine_templates.capitalization = pascal_case +cpp_naming_style.unreal_engine_templates.required_prefix = T +cpp_naming_style.unreal_engine_templates.required_suffix = +cpp_naming_style.unreal_engine_templates.word_separator = + +cpp_naming_style.unreal_engine_structs.capitalization = pascal_case +cpp_naming_style.unreal_engine_structs.required_prefix = F +cpp_naming_style.unreal_engine_structs.required_suffix = +cpp_naming_style.unreal_engine_structs.word_separator = + +cpp_naming_style.uobject_style.capitalization = pascal_case +cpp_naming_style.uobject_style.required_prefix = U +cpp_naming_style.uobject_style.required_suffix = +cpp_naming_style.uobject_style.word_separator = + +cpp_naming_style.aactor_style.capitalization = pascal_case +cpp_naming_style.aactor_style.required_prefix = A +cpp_naming_style.aactor_style.required_suffix = +cpp_naming_style.aactor_style.word_separator = + +cpp_naming_style.swidget_style.capitalization = pascal_case +cpp_naming_style.swidget_style.required_prefix = S +cpp_naming_style.swidget_style.required_suffix = +cpp_naming_style.swidget_style.word_separator = + +cpp_naming_style.boolean_style.capitalization = pascal_case +cpp_naming_style.boolean_style.required_prefix = b +cpp_naming_style.boolean_style.required_suffix = +cpp_naming_style.boolean_style.word_separator = \ No newline at end of file diff --git a/Config/DefaultInput.ini b/Config/DefaultInput.ini index 8c03c044..a457e63f 100644 --- a/Config/DefaultInput.ini +++ b/Config/DefaultInput.ini @@ -68,6 +68,7 @@ bCaptureMouseOnLaunch=True bEnableLegacyInputScales=True bEnableMotionControls=True bFilterInputByPlatformUser=False +bEnableInputDeviceSubsystem=True bShouldFlushPressedKeysOnViewportFocusLost=True bEnableDynamicComponentInputBinding=True bAlwaysShowTouchInterface=False @@ -90,6 +91,12 @@ DoubleClickTime=0.200000 +ActionMappings=(ActionName="Reload",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_FaceButton_Left) +ActionMappings=(ActionName="Crouch",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=C) +ActionMappings=(ActionName="Crouch",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_RightThumbstick) ++ActionMappings=(ActionName="FKey",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=F) ++ActionMappings=(ActionName="1Key",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=One) ++ActionMappings=(ActionName="2Key",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Two) ++ActionMappings=(ActionName="3Key",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Three) ++ActionMappings=(ActionName="4Key",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Four) ++ActionMappings=(ActionName="5Key",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Five) +AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=W) +AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=S) +AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=Gamepad_LeftY) diff --git a/Content/_Game/Assets/Textures/Icons/Backgrounds/CommonBackground.uasset b/Content/_Game/Assets/Textures/Icons/Backgrounds/CommonBackground.uasset new file mode 100644 index 00000000..98f5fe1c --- /dev/null +++ b/Content/_Game/Assets/Textures/Icons/Backgrounds/CommonBackground.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0d43818dbfcba2be2b32ee729ceff8a623698e37533fa5138eb39978d94ec6a +size 43142 diff --git a/Content/_Game/Assets/Textures/Icons/Backgrounds/DamagedBackground.uasset b/Content/_Game/Assets/Textures/Icons/Backgrounds/DamagedBackground.uasset new file mode 100644 index 00000000..7a5f5476 --- /dev/null +++ b/Content/_Game/Assets/Textures/Icons/Backgrounds/DamagedBackground.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d1059cad58ad03e3382b4361055cee45083baececfcdced9db27f593f567e2fe +size 25218 diff --git a/Content/_Game/Assets/Textures/Icons/Backgrounds/LegendaryBackground.uasset b/Content/_Game/Assets/Textures/Icons/Backgrounds/LegendaryBackground.uasset new file mode 100644 index 00000000..5dfe3a44 --- /dev/null +++ b/Content/_Game/Assets/Textures/Icons/Backgrounds/LegendaryBackground.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d156e7ffdce5f60f0466def0de7366754db974fc3c68417f3853baec14c8ad5 +size 43200 diff --git a/Content/_Game/Assets/Textures/Icons/Backgrounds/RareBackground.uasset b/Content/_Game/Assets/Textures/Icons/Backgrounds/RareBackground.uasset new file mode 100644 index 00000000..41ec4e66 --- /dev/null +++ b/Content/_Game/Assets/Textures/Icons/Backgrounds/RareBackground.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1bc7b051134504936c8f7e04d153f783ee835dceef038cdb2cbb88687236c361 +size 49968 diff --git a/Content/_Game/Assets/Textures/Icons/Backgrounds/UncommonBackground.uasset b/Content/_Game/Assets/Textures/Icons/Backgrounds/UncommonBackground.uasset new file mode 100644 index 00000000..f0933419 --- /dev/null +++ b/Content/_Game/Assets/Textures/Icons/Backgrounds/UncommonBackground.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c5e250edcdae012ee139df56459ade38fa5c5bd038100104a6c7766b3d665f0 +size 44754 diff --git a/Content/_Game/Assets/Textures/Icons/ButtonIcons/IconCircleOutlined2.uasset b/Content/_Game/Assets/Textures/Icons/ButtonIcons/IconCircleOutlined2.uasset new file mode 100644 index 00000000..af5af287 --- /dev/null +++ b/Content/_Game/Assets/Textures/Icons/ButtonIcons/IconCircleOutlined2.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1fa9ca86156480bfcf49622a54a27c1ba9ee709a6ce902e56c02ba4bd1355749 +size 7061 diff --git a/Content/_Game/Assets/Textures/Icons/ButtonIcons/InventorySelectButton.uasset b/Content/_Game/Assets/Textures/Icons/ButtonIcons/InventorySelectButton.uasset new file mode 100644 index 00000000..d5b36c9b --- /dev/null +++ b/Content/_Game/Assets/Textures/Icons/ButtonIcons/InventorySelectButton.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16a328e14cc0564c7f0217b2b2f06fa5a54f5ff8a245b677d8d8e77e60c64ec8 +size 8525 diff --git a/Content/_Game/Assets/Textures/Icons/ButtonIcons/InventorySelectButton2.uasset b/Content/_Game/Assets/Textures/Icons/ButtonIcons/InventorySelectButton2.uasset new file mode 100644 index 00000000..5e1fd2de --- /dev/null +++ b/Content/_Game/Assets/Textures/Icons/ButtonIcons/InventorySelectButton2.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c89327526ffe7864cfb19f89a24ec331448b6c639ddd638c86a551a7769c3cb6 +size 8555 diff --git a/Content/_Game/Assets/Textures/Icons/IconCircleOutlined2.uasset b/Content/_Game/Assets/Textures/Icons/IconCircleOutlined2.uasset deleted file mode 100644 index a5c0953e..00000000 --- a/Content/_Game/Assets/Textures/Icons/IconCircleOutlined2.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4d9b2953b1a4094de274bf3aaa24127620f1c6c14f93d5e3e62da5230c0a3b08 -size 6856 diff --git a/Content/_Game/Assets/Textures/Icons/WeaponIcons/ARIcon2.uasset b/Content/_Game/Assets/Textures/Icons/WeaponIcons/ARIcon2.uasset new file mode 100644 index 00000000..af457367 --- /dev/null +++ b/Content/_Game/Assets/Textures/Icons/WeaponIcons/ARIcon2.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75588e8aaf8febc2bddfe9e51113e6d1ff524eead1f5152499d48b8fbc7f1312 +size 52507 diff --git a/Content/_Game/Assets/Textures/Icons/WeaponIcons/SMGIcon.uasset b/Content/_Game/Assets/Textures/Icons/WeaponIcons/SMGIcon.uasset new file mode 100644 index 00000000..33e6bd08 --- /dev/null +++ b/Content/_Game/Assets/Textures/Icons/WeaponIcons/SMGIcon.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:60c671aea70ae12421fd4f7e52c6309eea343498c3695838e68cb3cb49286bca +size 66405 diff --git a/Content/_Game/Character/ShooterCharacterBP.uasset b/Content/_Game/Character/ShooterCharacterBP.uasset index 489f2d16..b7a8ec71 100644 --- a/Content/_Game/Character/ShooterCharacterBP.uasset +++ b/Content/_Game/Character/ShooterCharacterBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b3a3497a01605aa8b46c8c3616e1fe03c9d6c5c9704030c41c51826c6f6ff283 -size 44862 +oid sha256:8d4dab08311e3296b428f4c86b02a039ea3546d0e0a07146274f8f5cd6d53bb3 +size 44695 diff --git a/Content/_Game/GameMode/ShooterGameModeBaseBP.uasset b/Content/_Game/GameMode/ShooterGameModeBaseBP.uasset index e2df9063..ad6f053b 100644 --- a/Content/_Game/GameMode/ShooterGameModeBaseBP.uasset +++ b/Content/_Game/GameMode/ShooterGameModeBaseBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d33e9bd23a717b85e841feb1612d9897b3be0ba42429f4ad86879de97ec73bbd -size 20112 +oid sha256:2b04a97012ddb103db5a369fd1c9d30758a527d859754539d3f8a757c1c91f09 +size 20836 diff --git a/Content/_Game/HUD/AmmoCountBP.uasset b/Content/_Game/HUD/AmmoCountBP.uasset index a137b308..2d72d7ea 100644 --- a/Content/_Game/HUD/AmmoCountBP.uasset +++ b/Content/_Game/HUD/AmmoCountBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ac38ea3e6200f2ea630e848fe6f27a967bd8458e33dc7b1c77155212a7f999cd -size 107758 +oid sha256:62c1225ac9142622a700a12b4ffe59a7d3700d1c02852543718ac63172ec3939 +size 106258 diff --git a/Content/_Game/HUD/AmmoPickupWidget.uasset b/Content/_Game/HUD/AmmoPickupWidget.uasset index 159b58c8..fba5ad78 100644 --- a/Content/_Game/HUD/AmmoPickupWidget.uasset +++ b/Content/_Game/HUD/AmmoPickupWidget.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3ee34dee66c3076fec4774e4161abae270c65cd5e69afcef1124d28bae40e2ee -size 56134 +oid sha256:25803faba08d472f787a09c6bff1146bb3c18ccb4ecb6b417f9296e3ef7e0b31 +size 56130 diff --git a/Content/_Game/HUD/InventoryBar.uasset b/Content/_Game/HUD/InventoryBar.uasset new file mode 100644 index 00000000..c59e45fc --- /dev/null +++ b/Content/_Game/HUD/InventoryBar.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0e4a52a7c6b612f3fa955294a61b53e6791a99ab4c684eff77980a2d069e54f +size 319225 diff --git a/Content/_Game/HUD/PickupWidgetBP.uasset b/Content/_Game/HUD/PickupWidgetBP.uasset index b43b065b..174d3654 100644 --- a/Content/_Game/HUD/PickupWidgetBP.uasset +++ b/Content/_Game/HUD/PickupWidgetBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7f09dcbc05493657c72a7d589888790570edc2aec4b6651e3d9fccb8da22394f -size 182618 +oid sha256:d23e00ad49871001c14ee345ad0d8df2d48c24c26edc9d047b6ed0e54867abd3 +size 181060 diff --git a/Content/_Game/HUD/ShooterHUDBP.uasset b/Content/_Game/HUD/ShooterHUDBP.uasset index a6a3cee7..bb8749bd 100644 --- a/Content/_Game/HUD/ShooterHUDBP.uasset +++ b/Content/_Game/HUD/ShooterHUDBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e62d4844f70f3b4b26af147f2e226de9ce497c417e3b9287d0dd4a8ce6bec9ca -size 244805 +oid sha256:c147dae153e56f394c8e7c27bf1603c83fb62ab4df376d7479af870c451c2987 +size 241110 diff --git a/Content/_Game/HUD/ShooterHUDOverlayBP.uasset b/Content/_Game/HUD/ShooterHUDOverlayBP.uasset index 4aa67c5b..64142b3a 100644 --- a/Content/_Game/HUD/ShooterHUDOverlayBP.uasset +++ b/Content/_Game/HUD/ShooterHUDOverlayBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6d7eb85c717caf93d7defe7a1c830d1c2b1f44e873bc09d16bff0dd543e17350 -size 23946 +oid sha256:591b7464db29528f51663ca5dfa348250095bd99541491b5f30b941634f59794 +size 30217 diff --git a/Content/_Game/HUD/WeaponSlot.uasset b/Content/_Game/HUD/WeaponSlot.uasset new file mode 100644 index 00000000..8983f81a --- /dev/null +++ b/Content/_Game/HUD/WeaponSlot.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d84266c7fe496b5c8e40238d9495911b1d2ae41e734e54d4dbafa0fad164ff11 +size 295355 diff --git a/Content/_Game/Maps/DefaultMap.umap b/Content/_Game/Maps/DefaultMap.umap index b5fefeb5..ac84d526 100644 --- a/Content/_Game/Maps/DefaultMap.umap +++ b/Content/_Game/Maps/DefaultMap.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:074772a746368b9eabc6ff2bd5f9b156a50a031ee06934d613a1cf4501c7c907 -size 98354 +oid sha256:b2a8bc583394dc1c9bd699e5d5e6d5f392ea17beada0006c38b3bde2a9b04ee2 +size 98133 diff --git a/Content/_Game/Weapons/BaseWeapon/BaseWeaponBP.uasset b/Content/_Game/Weapons/BaseWeapon/BaseWeaponBP.uasset index dade3f9e..a13cae59 100644 --- a/Content/_Game/Weapons/BaseWeapon/BaseWeaponBP.uasset +++ b/Content/_Game/Weapons/BaseWeapon/BaseWeaponBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce63d4716946991323e25b20dacfde54cc356d20f3fbde443c9b9dd60d933360 -size 53201 +oid sha256:d9f42a6201674a713536a81c5f52ad271b0d849d84f05a112ecbb85470a23201 +size 53929 diff --git a/Content/_Game/Weapons/BaseWeapon/SMGAnimBP.uasset b/Content/_Game/Weapons/BaseWeapon/SMGAnimBP.uasset index 6b6e3755..4bccbddd 100644 --- a/Content/_Game/Weapons/BaseWeapon/SMGAnimBP.uasset +++ b/Content/_Game/Weapons/BaseWeapon/SMGAnimBP.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:710541fb433e0066d7294c0ca0e6781f08d710c1713fd6703371999d20e12576 -size 192432 +oid sha256:f9c236517d2fa84d152aa62f131af8b8bcd43411257c108bc98a2d89847bb0f6 +size 186713 diff --git a/Shooter.uproject b/Shooter.uproject index f97f35a2..2fbe866d 100644 --- a/Shooter.uproject +++ b/Shooter.uproject @@ -41,6 +41,14 @@ { "Name": "BlueprintSnapNodes", "Enabled": true + }, + { + "Name": "VisualStudioTools", + "Enabled": true, + "MarketplaceURL": "com.epicgames.launcher://ue/marketplace/product/362651520df94e4fa65492dbcba44ae2", + "SupportedTargetPlatforms": [ + "Win64" + ] } ] } \ No newline at end of file diff --git a/Source/Shooter/Item.cpp b/Source/Shooter/Item.cpp index f15055ad..4ea435a5 100644 --- a/Source/Shooter/Item.cpp +++ b/Source/Shooter/Item.cpp @@ -31,10 +31,11 @@ AItem::AItem() : MaterialIndex(0), bCanChangeCustomDepth(true), // Dynamic Material Parameters + PulseCurveTime(5.f), GlowAmount(150.f), FresnelExponent(3.f), FresnelReflectFraction(4.f), - PulseCurveTime(5.f) + SlotIndex(0) { // 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; @@ -77,6 +78,17 @@ void AItem::BeginPlay() InitializeCustomDepth(); StartPulseTimer(); + + // We wait a small delay to make sure all actors are spawned, + // then we set a small sphere radius and reset it again, + // this generates any overlap events that weren't accounted for on spawn + FTimerHandle TimerHandle; + GetWorldTimerManager().SetTimer(TimerHandle, [&]() + { + AreaSphereRadius = AreaSphere->GetUnscaledSphereRadius(); + AreaSphere->SetSphereRadius(1.f); + AreaSphere->SetSphereRadius(AreaSphereRadius); + }, 0.5, false); } void AItem::setActiveStars() @@ -425,6 +437,24 @@ void AItem::SetItemProperties(EItemState State) AreaSphere->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore); AreaSphere->SetCollisionEnabled(ECollisionEnabled::NoCollision); + // Set CollisionBox properties + CollisionBox->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore); + CollisionBox->SetCollisionEnabled(ECollisionEnabled::NoCollision); + break; + case EItemState::EIS_PickedUp: + PickupWidget->SetVisibility(false); + + // Set Mesh properties + ItemMesh->SetSimulatePhysics(false); + ItemMesh->SetEnableGravity(false); + ItemMesh->SetVisibility(false); + ItemMesh->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore); + ItemMesh->SetCollisionEnabled(ECollisionEnabled::NoCollision); + + // Set AreaSphere properties + AreaSphere->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore); + AreaSphere->SetCollisionEnabled(ECollisionEnabled::NoCollision); + // Set CollisionBox properties CollisionBox->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore); CollisionBox->SetCollisionEnabled(ECollisionEnabled::NoCollision); @@ -477,7 +507,6 @@ void AItem::FinishInterping() // Subtract 1 from the Item Count of the interp location struct Character->IncrementInterpLocItemCount(InterpLocIndex, -1); Character->GetPickupItem(this); - SetItemState(EItemState::EIS_PickedUp); } // Set scale back to normal SetActorScale3D(FVector(1.f)); diff --git a/Source/Shooter/Item.h b/Source/Shooter/Item.h index f169df86..1063bdab 100644 --- a/Source/Shooter/Item.h +++ b/Source/Shooter/Item.h @@ -120,6 +120,9 @@ private: UPROPERTY(VisibleAnywhere, BlueprintReadonly, Category = "Item Properties", meta = (AllowPrivateAccess = true)) USkeletalMeshComponent* ItemMesh; + UPROPERTY(VisibleAnywhere, BlueprintReadonly, Category = "Item Properties", meta = (AllowPrivateAccess = true)) + float AreaSphereRadius; + /* The name which appears on the Pickup Widget */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Item Properties", meta = (AllowPrivateAccess = true)) FString ItemName; @@ -233,6 +236,22 @@ private: UPROPERTY(VisibleAnywhere, Category = "Item Properties", meta = (AllowPrivateAccess = true)) float FresnelReflectFraction; + /** Background for this item in the inventory */ + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = true)) + UTexture2D* IconBackground; + + /** Icon for this item in the inventory */ + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = true)) + UTexture2D* IconItem; + + /** Icon for this item's ammo in the inventory */ + UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = true)) + UTexture2D* IconAmmo; + + /** Slot in the inventory array */ + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = true)) + int32 SlotIndex; + public: FORCEINLINE UWidgetComponent* GetPickupWidget() const { return PickupWidget; } @@ -250,7 +269,10 @@ public: FORCEINLINE USoundCue* GetEquipSound() const { return EquipSound; } FORCEINLINE int32 GetItemCount() const { return ItemCount; } - + + FORCEINLINE int32 GetSlotIndex() const { return SlotIndex; } + FORCEINLINE void SetSlotIndex(int32 Index) { SlotIndex = Index; } + /** Called from the AShooterCharacter class */ void StartItemCurve(AShooterCharacter* Char); diff --git a/Source/Shooter/ShooterAnimInstance.cpp b/Source/Shooter/ShooterAnimInstance.cpp index 278d912f..e179fdda 100644 --- a/Source/Shooter/ShooterAnimInstance.cpp +++ b/Source/Shooter/ShooterAnimInstance.cpp @@ -17,6 +17,8 @@ UShooterAnimInstance::UShooterAnimInstance() : TIPCharacterYaw(0.f), TIPCharacterYawLastFrame(0.f), RootYawOffset(0.f), + RotationCurve(0.f), + RotationCurveLastFrame(0.f), Pitch(0.f), bReloading(false), OffsetState(EOffsetState::EOS_Hip), @@ -87,6 +89,11 @@ void UShooterAnimInstance::NativeInitializeAnimation() Super::NativeInitializeAnimation(); ShooterCharacter = Cast(TryGetPawnOwner()); + + if (!ShooterCharacter) return; + + TIPCharacterYaw = ShooterCharacter->GetActorRotation().Yaw; + TIPCharacterYawLastFrame = TIPCharacterYaw; } void UShooterAnimInstance::TurnInPlace() diff --git a/Source/Shooter/ShooterCharacter.cpp b/Source/Shooter/ShooterCharacter.cpp index 1ee0479a..f2a34270 100644 --- a/Source/Shooter/ShooterCharacter.cpp +++ b/Source/Shooter/ShooterCharacter.cpp @@ -150,6 +150,8 @@ void AShooterCharacter::BeginPlay() // Spawn the default weapon and equip it EquipWeapon(SpawnDefaultWeapon()); + Inventory.Add(EquippedWeapon); + EquippedWeapon->SetSlotIndex(0); InitializeAmmoMap(); @@ -175,26 +177,25 @@ void AShooterCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCo PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &AShooterCharacter::Jump); PlayerInputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping); - PlayerInputComponent->BindAction("FireButton", IE_Pressed, this, - &AShooterCharacter::FireButtonPressed); - PlayerInputComponent->BindAction("FireButton", IE_Released, this, - &AShooterCharacter::FireButtonReleased); + PlayerInputComponent->BindAction("FireButton", IE_Pressed, this, &AShooterCharacter::FireButtonPressed); + PlayerInputComponent->BindAction("FireButton", IE_Released, this, &AShooterCharacter::FireButtonReleased); - PlayerInputComponent->BindAction("Aiming", IE_Pressed, this, - &AShooterCharacter::AimingButtonPressed); - PlayerInputComponent->BindAction("Aiming", IE_Released, this, - &AShooterCharacter::AimingButtonReleased); + PlayerInputComponent->BindAction("Aiming", IE_Pressed, this, &AShooterCharacter::AimingButtonPressed); + PlayerInputComponent->BindAction("Aiming", IE_Released, this, &AShooterCharacter::AimingButtonReleased); - PlayerInputComponent->BindAction("Select", IE_Pressed, this, - &AShooterCharacter::SelectButtonPressed); - PlayerInputComponent->BindAction("Select", IE_Released, this, - &AShooterCharacter::SelectButtonReleased); + PlayerInputComponent->BindAction("Select", IE_Pressed, this, &AShooterCharacter::SelectButtonPressed); + PlayerInputComponent->BindAction("Select", IE_Released, this, &AShooterCharacter::SelectButtonReleased); - PlayerInputComponent->BindAction("Reload", IE_Pressed, this, - &AShooterCharacter::ReloadButtonPressed); + PlayerInputComponent->BindAction("Reload", IE_Pressed, this, &AShooterCharacter::ReloadButtonPressed); - PlayerInputComponent->BindAction("Crouch", IE_Pressed, this, - &AShooterCharacter::CrouchButtonPressed); + PlayerInputComponent->BindAction("Crouch", IE_Pressed, this, &AShooterCharacter::CrouchButtonPressed); + + PlayerInputComponent->BindAction("FKey", IE_Pressed, this, &AShooterCharacter::KeyFPressed); + PlayerInputComponent->BindAction("1Key", IE_Pressed, this, &AShooterCharacter::Key1Pressed); + PlayerInputComponent->BindAction("2Key", IE_Pressed, this, &AShooterCharacter::Key2Pressed); + PlayerInputComponent->BindAction("3Key", IE_Pressed, this, &AShooterCharacter::Key3Pressed); + PlayerInputComponent->BindAction("4Key", IE_Pressed, this, &AShooterCharacter::Key4Pressed); + PlayerInputComponent->BindAction("5Key", IE_Pressed, this, &AShooterCharacter::Key5Pressed); } // Called every frame @@ -373,6 +374,56 @@ void AShooterCharacter::ResetEquipSoundTimer() bShouldPlayEquipSound = true; } +void AShooterCharacter::KeyFPressed() +{ + if (EquippedWeapon->GetSlotIndex() == 0) return; + + ExchangeInventoryItems(EquippedWeapon->GetSlotIndex(), 0); +} + +void AShooterCharacter::Key1Pressed() +{ + if (EquippedWeapon->GetSlotIndex() == 1) return; + ExchangeInventoryItems(EquippedWeapon->GetSlotIndex(), 1); +} + +void AShooterCharacter::Key2Pressed() +{ + if (EquippedWeapon->GetSlotIndex() == 2) return; + ExchangeInventoryItems(EquippedWeapon->GetSlotIndex(), 2); +} + +void AShooterCharacter::Key3Pressed() +{ + if (EquippedWeapon->GetSlotIndex() == 3) return; + ExchangeInventoryItems(EquippedWeapon->GetSlotIndex(), 3); +} + +void AShooterCharacter::Key4Pressed() +{ + if (EquippedWeapon->GetSlotIndex() == 4) return; + ExchangeInventoryItems(EquippedWeapon->GetSlotIndex(), 4); +} + +void AShooterCharacter::Key5Pressed() +{ + if (EquippedWeapon->GetSlotIndex() == 5) return; + ExchangeInventoryItems(EquippedWeapon->GetSlotIndex(), 5); +} + +void AShooterCharacter::ExchangeInventoryItems(int32 CurrentItemIndex, int32 NewItemIndex) +{ + if (CurrentItemIndex == NewItemIndex || NewItemIndex >= Inventory.Num()) return; + + auto OldEquippedWeapon = EquippedWeapon; + auto NewWeapon = Cast(Inventory[NewItemIndex]); + + EquipWeapon(NewWeapon); + + OldEquippedWeapon->SetItemState(EItemState::EIS_PickedUp); + NewWeapon->SetItemState(EItemState::EIS_Equipped); +} + int32 AShooterCharacter::GetInterpLocationIndex() { int32 LowestIndex = 1; @@ -695,20 +746,27 @@ void AShooterCharacter::TraceForItems() FHitResult ItemTraceResult; FVector HitLocation; TraceUnderCrosshairs(ItemTraceResult, HitLocation); + + TraceHitItem = Cast(ItemTraceResult.GetActor()); - if (ItemTraceResult.bBlockingHit) + if (TraceHitItem && ItemTraceResult.bBlockingHit) { // If an item was being looked at from last frame, we should hide its widget - SetItemPickupWidgetVisibility(TraceHitItem, false); - + if (OldTraceHitItem != TraceHitItem) + SetItemPickupWidgetVisibility(OldTraceHitItem, false); + // Show the new item's widget - TraceHitItem = Cast(ItemTraceResult.GetActor()); + OldTraceHitItem = TraceHitItem; + + if (TraceHitItem && TraceHitItem->GetItemState() == EItemState::EIS_EquipInterping) + TraceHitItem = nullptr; + SetItemPickupWidgetVisibility(TraceHitItem, true); } - else if (TraceHitItem) // Hide widget for the item from last frame + else if (OldTraceHitItem) // Hide widget for the item from last frame { - SetItemPickupWidgetVisibility(TraceHitItem, false); - TraceHitItem = nullptr; + SetItemPickupWidgetVisibility(OldTraceHitItem, false); + OldTraceHitItem = nullptr; } } else if (TraceHitItem) // Hide widget for the item from last frame @@ -751,6 +809,16 @@ void AShooterCharacter::EquipWeapon(AWeapon* WeaponToEquip) // Attach the weapon to the hand socket RightHandSocket HandSocket->AttachActor(WeaponToEquip, GetMesh()); + if (EquippedWeapon == nullptr) + { + // -1 == no EquippedWeapon yet. No need to reverse the icon animation + EquipItemDelegate.Broadcast(-1, WeaponToEquip->GetSlotIndex()); + } + else + { + EquipItemDelegate.Broadcast(EquippedWeapon->GetSlotIndex(), WeaponToEquip->GetSlotIndex()); + } + EquippedWeapon = WeaponToEquip; EquippedWeapon->SetItemState(EItemState::EIS_Equipped); @@ -776,6 +844,7 @@ void AShooterCharacter::SelectButtonPressed() if (TraceHitItem) { TraceHitItem->StartItemCurve(this); + TraceHitItem = nullptr; } } @@ -785,6 +854,12 @@ void AShooterCharacter::SelectButtonReleased() void AShooterCharacter::SwapWeapon(AWeapon* WeaponToSwap) { + if (EquippedWeapon->GetSlotIndex() <= Inventory.Num() - 1) + { + Inventory[EquippedWeapon->GetSlotIndex()] = WeaponToSwap; + WeaponToSwap->SetSlotIndex(EquippedWeapon->GetSlotIndex()); + } + DropWeapon(); EquipWeapon(WeaponToSwap); } @@ -840,7 +915,16 @@ void AShooterCharacter::GetPickupItem(AItem* Item) if (Weapon) { - SwapWeapon(Weapon); + if (Inventory.Num() < INVENTORY_CAPACITY) + { + Weapon->SetSlotIndex(Inventory.Num()); + Inventory.Add(Weapon); + Weapon->SetItemState(EItemState::EIS_PickedUp); + } + else // Inventory is full! Swap with EquippedWeapon + { + SwapWeapon(Weapon); + } } auto Ammo = Cast(Item); diff --git a/Source/Shooter/ShooterCharacter.h b/Source/Shooter/ShooterCharacter.h index b5dcd31c..6cfd14bd 100644 --- a/Source/Shooter/ShooterCharacter.h +++ b/Source/Shooter/ShooterCharacter.h @@ -42,6 +42,9 @@ struct FInterpLocation int32 ItemCount; }; +DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FEquipItemDelegate, int32, CurrentSlotIndex, int32, NewSlotIndex); + + UCLASS() class SHOOTER_API AShooterCharacter : public ACharacter { @@ -194,6 +197,15 @@ protected: void ResetPickupSoundTimer(); void ResetEquipSoundTimer(); + void KeyFPressed(); + void Key1Pressed(); + void Key2Pressed(); + void Key3Pressed(); + void Key4Pressed(); + void Key5Pressed(); + + void ExchangeInventoryItems(int32 CurrentItemIndex, int32 NewItemIndex); + private: UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = true)) USpringArmComponent* CameraBoom; @@ -338,6 +350,10 @@ private: UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Combat, meta = (AllowPrivateAccess = true)) AItem* TraceHitItem; + /** Item hit by our trace in TraceForItems() from last frame (could be null) */ + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Combat, meta = (AllowPrivateAccess = true)) + AItem* OldTraceHitItem; + /** Distance outward from the camera for the interp destination */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Items, meta = (AllowPrivateAccess = true)) float CameraInterpDistance; @@ -443,6 +459,16 @@ private: UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Items, meta = (AllowPrivateAccess = true)) float EquipSoundResetTime; + /** An array of AItems for our inventory */ + UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = true)) + TArray Inventory; + + const int32 INVENTORY_CAPACITY{ 6 }; + + /** Delegate for sending slot information to InventoryBar when equipping */ + UPROPERTY(BlueprintAssignable, Category = Delegates, meta = (AllowPrivateAccess = true)) + FEquipItemDelegate EquipItemDelegate; + public: /* Returns CameraBoom SubObject */ FORCEINLINE USpringArmComponent* GetCameraBoom() const { return CameraBoom; } diff --git a/Source/ShooterEditor.Target.cs b/Source/ShooterEditor.Target.cs index 6ba95104..aee4d95d 100644 --- a/Source/ShooterEditor.Target.cs +++ b/Source/ShooterEditor.Target.cs @@ -8,8 +8,8 @@ public class ShooterEditorTarget : TargetRules public ShooterEditorTarget( TargetInfo Target) : base(Target) { Type = TargetType.Editor; - DefaultBuildSettings = BuildSettingsVersion.V2; - IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_2; + DefaultBuildSettings = BuildSettingsVersion.V4; + IncludeOrderVersion = EngineIncludeOrderVersion.Latest; ExtraModuleNames.AddRange( new string[] { "Shooter" } ); } } diff --git a/shadertoolsconfig.json b/shadertoolsconfig.json new file mode 100644 index 00000000..9e8ecb44 --- /dev/null +++ b/shadertoolsconfig.json @@ -0,0 +1,8 @@ +{ + "hlsl.preprocessorDefinitions": { + }, + " hlsl.additionalIncludeDirectories": [ + ], + "hlsl.virtualDirectoryMappings": { + } +}