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()
|
void AItem::UpdatePulse()
|
||||||
{
|
{
|
||||||
if (ItemState != EItemState::EIS_Pickup) return;
|
float ElapsedTime{};
|
||||||
|
FVector CurveValue{};
|
||||||
const float ElapsedTime { GetWorldTimerManager().GetTimerElapsed(PulseTimer) };
|
|
||||||
if (PulseCurve)
|
|
||||||
{
|
|
||||||
const FVector CurveValue{ PulseCurve->GetVectorValue(ElapsedTime) };
|
|
||||||
|
|
||||||
|
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("GlowAmount"), CurveValue.X * GlowAmount);
|
||||||
DynamicMaterialInstance->SetScalarParameterValue(TEXT("FresnelExponent"), CurveValue.Y * FresnelExponent);
|
DynamicMaterialInstance->SetScalarParameterValue(TEXT("FresnelExponent"), CurveValue.Y * FresnelExponent);
|
||||||
DynamicMaterialInstance->SetScalarParameterValue(TEXT("FresnelReflectFraction"), CurveValue.Z * FresnelReflectFraction);
|
DynamicMaterialInstance->SetScalarParameterValue(TEXT("FresnelReflectFraction"), CurveValue.Z * FresnelReflectFraction);
|
||||||
|
@ -434,6 +450,7 @@ void AItem::StartItemCurve(AShooterCharacter* Char)
|
||||||
|
|
||||||
bInterping = true;
|
bInterping = true;
|
||||||
SetItemState(EItemState::EIS_EquipInterping);
|
SetItemState(EItemState::EIS_EquipInterping);
|
||||||
|
GetWorldTimerManager().ClearTimer(PulseTimer);
|
||||||
|
|
||||||
GetWorldTimerManager().SetTimer(ItemInterpTimer, this,
|
GetWorldTimerManager().SetTimer(ItemInterpTimer, this,
|
||||||
&AItem::FinishInterping, ZCurveTime);
|
&AItem::FinishInterping, ZCurveTime);
|
||||||
|
@ -459,8 +476,8 @@ void AItem::FinishInterping()
|
||||||
{
|
{
|
||||||
// Subtract 1 from the Item Count of the interp location struct
|
// Subtract 1 from the Item Count of the interp location struct
|
||||||
Character->IncrementInterpLocItemCount(InterpLocIndex, -1);
|
Character->IncrementInterpLocItemCount(InterpLocIndex, -1);
|
||||||
|
|
||||||
Character->GetPickupItem(this);
|
Character->GetPickupItem(this);
|
||||||
|
SetItemState(EItemState::EIS_PickedUp);
|
||||||
}
|
}
|
||||||
// Set scale back to normal
|
// Set scale back to normal
|
||||||
SetActorScale3D(FVector(1.f));
|
SetActorScale3D(FVector(1.f));
|
||||||
|
|
|
@ -213,6 +213,10 @@ private:
|
||||||
/** Curve to drive the dynamic material parameters */
|
/** Curve to drive the dynamic material parameters */
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item Properties", meta = (AllowPrivateAccess = true))
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item Properties", meta = (AllowPrivateAccess = true))
|
||||||
UCurveVector* PulseCurve;
|
UCurveVector* PulseCurve;
|
||||||
|
|
||||||
|
/** Curve to drive the dynamic material parameters */
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Item Properties", meta = (AllowPrivateAccess = true))
|
||||||
|
UCurveVector* InterpPulseCurve;
|
||||||
|
|
||||||
FTimerHandle PulseTimer;
|
FTimerHandle PulseTimer;
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ void AShooterCharacter::BeginPlay()
|
||||||
CameraDefaultFOV = FollowCamera->FieldOfView;
|
CameraDefaultFOV = FollowCamera->FieldOfView;
|
||||||
CameraCurrentFOV = CameraDefaultFOV;
|
CameraCurrentFOV = CameraDefaultFOV;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spawn the default weapon and equip it
|
// Spawn the default weapon and equip it
|
||||||
EquipWeapon(SpawnDefaultWeapon());
|
EquipWeapon(SpawnDefaultWeapon());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue