Section 10: Outline and Glow Effects - Lecture 169
Inventory Slot Widget
This commit is contained in:
parent
0d55a2ef39
commit
7ef3265886
Binary file not shown.
BIN
Content/_Game/Maps/DefaultMap.umap (Stored with Git LFS)
BIN
Content/_Game/Maps/DefaultMap.umap (Stored with Git LFS)
Binary file not shown.
BIN
Content/_Game/Materials/SMGMaterials/M_SMG_Mat_Inst.uasset (Stored with Git LFS)
BIN
Content/_Game/Materials/SMGMaterials/M_SMG_Mat_Inst.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/_Game/Weapons/BaseWeapon/BaseWeaponBP.uasset (Stored with Git LFS)
BIN
Content/_Game/Weapons/BaseWeapon/BaseWeaponBP.uasset (Stored with Git LFS)
Binary file not shown.
|
@ -162,13 +162,29 @@ void AItem::OnConstruction(const FTransform& Transform)
|
|||
|
||||
void AItem::UpdatePulse()
|
||||
{
|
||||
if (ItemState != EItemState::EIS_Pickup) return;
|
||||
float ElapsedTime{};
|
||||
FVector CurveValue{};
|
||||
|
||||
const float ElapsedTime { GetWorldTimerManager().GetTimerElapsed(PulseTimer) };
|
||||
switch (ItemState)
|
||||
{
|
||||
case EItemState::EIS_Pickup:
|
||||
if (PulseCurve)
|
||||
{
|
||||
const FVector CurveValue{ PulseCurve->GetVectorValue(ElapsedTime) };
|
||||
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));
|
||||
|
|
|
@ -214,6 +214,10 @@ private:
|
|||
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;
|
||||
|
||||
/** Time for the pulse timer */
|
||||
|
|
Loading…
Reference in New Issue