diff --git a/Content/_Game/Curves/MaterialInterpCurve.uasset b/Content/_Game/Curves/MaterialInterpCurve.uasset new file mode 100644 index 00000000..f55dc314 Binary files /dev/null and b/Content/_Game/Curves/MaterialInterpCurve.uasset differ diff --git a/Content/_Game/Maps/DefaultMap.umap b/Content/_Game/Maps/DefaultMap.umap index 5a4da9a9..b303f338 100644 Binary files a/Content/_Game/Maps/DefaultMap.umap and b/Content/_Game/Maps/DefaultMap.umap differ diff --git a/Content/_Game/Materials/SMGMaterials/M_SMG_Mat_Inst.uasset b/Content/_Game/Materials/SMGMaterials/M_SMG_Mat_Inst.uasset index 64beaabf..64f32841 100644 Binary files a/Content/_Game/Materials/SMGMaterials/M_SMG_Mat_Inst.uasset and b/Content/_Game/Materials/SMGMaterials/M_SMG_Mat_Inst.uasset differ diff --git a/Content/_Game/Weapons/BaseWeapon/BaseWeaponBP.uasset b/Content/_Game/Weapons/BaseWeapon/BaseWeaponBP.uasset index 25135b8b..84f76e68 100644 Binary files a/Content/_Game/Weapons/BaseWeapon/BaseWeaponBP.uasset and b/Content/_Game/Weapons/BaseWeapon/BaseWeaponBP.uasset differ diff --git a/Source/Shooter/Item.cpp b/Source/Shooter/Item.cpp index fdc20b52..f15055ad 100644 --- a/Source/Shooter/Item.cpp +++ b/Source/Shooter/Item.cpp @@ -162,13 +162,29 @@ void AItem::OnConstruction(const FTransform& Transform) void AItem::UpdatePulse() { - if (ItemState != EItemState::EIS_Pickup) return; - - const float ElapsedTime { GetWorldTimerManager().GetTimerElapsed(PulseTimer) }; - if (PulseCurve) - { - const FVector CurveValue{ PulseCurve->GetVectorValue(ElapsedTime) }; + float ElapsedTime{}; + FVector CurveValue{}; + switch (ItemState) + { + case EItemState::EIS_Pickup: + if (PulseCurve) + { + ElapsedTime = GetWorldTimerManager().GetTimerElapsed(PulseTimer); + CurveValue = PulseCurve->GetVectorValue(ElapsedTime); + } + break; + case EItemState::EIS_EquipInterping: + if (InterpPulseCurve) + { + ElapsedTime = GetWorldTimerManager().GetTimerElapsed(ItemInterpTimer); + CurveValue = InterpPulseCurve->GetVectorValue(ElapsedTime); + } + break; + } + + if (DynamicMaterialInstance) + { DynamicMaterialInstance->SetScalarParameterValue(TEXT("GlowAmount"), CurveValue.X * GlowAmount); DynamicMaterialInstance->SetScalarParameterValue(TEXT("FresnelExponent"), CurveValue.Y * FresnelExponent); DynamicMaterialInstance->SetScalarParameterValue(TEXT("FresnelReflectFraction"), CurveValue.Z * FresnelReflectFraction); @@ -434,6 +450,7 @@ void AItem::StartItemCurve(AShooterCharacter* Char) bInterping = true; SetItemState(EItemState::EIS_EquipInterping); + GetWorldTimerManager().ClearTimer(PulseTimer); GetWorldTimerManager().SetTimer(ItemInterpTimer, this, &AItem::FinishInterping, ZCurveTime); @@ -459,8 +476,8 @@ 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 256242a6..f169df86 100644 --- a/Source/Shooter/Item.h +++ b/Source/Shooter/Item.h @@ -213,6 +213,10 @@ private: /** Curve to drive the dynamic material parameters */ UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item Properties", meta = (AllowPrivateAccess = true)) UCurveVector* PulseCurve; + + /** Curve to drive the dynamic material parameters */ + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item Properties", meta = (AllowPrivateAccess = true)) + UCurveVector* InterpPulseCurve; FTimerHandle PulseTimer; diff --git a/Source/Shooter/ShooterCharacter.cpp b/Source/Shooter/ShooterCharacter.cpp index f93df1b2..1ee0479a 100644 --- a/Source/Shooter/ShooterCharacter.cpp +++ b/Source/Shooter/ShooterCharacter.cpp @@ -147,7 +147,7 @@ void AShooterCharacter::BeginPlay() CameraDefaultFOV = FollowCamera->FieldOfView; CameraCurrentFOV = CameraDefaultFOV; } - + // Spawn the default weapon and equip it EquipWeapon(SpawnDefaultWeapon());