195 - Post Edit Change Property
This commit is contained in:
parent
fec03cfb8e
commit
b3f783a453
Binary file not shown.
Binary file not shown.
|
@ -16,6 +16,23 @@ AProjectileBullet::AProjectileBullet()
|
|||
ProjectileMovementComponent->MaxSpeed = InitialSpeed;
|
||||
}
|
||||
|
||||
#if WITH_EDITOR
|
||||
void AProjectileBullet::PostEditChangeProperty(FPropertyChangedEvent& Event)
|
||||
{
|
||||
Super::PostEditChangeProperty(Event);
|
||||
|
||||
const FName PropertyName = Event.Property != nullptr ? Event.Property->GetFName() : NAME_None;
|
||||
if (PropertyName == GET_MEMBER_NAME_CHECKED(AProjectileBullet, InitialSpeed))
|
||||
{
|
||||
if (ProjectileMovementComponent)
|
||||
{
|
||||
ProjectileMovementComponent->InitialSpeed = InitialSpeed;
|
||||
ProjectileMovementComponent->MaxSpeed = InitialSpeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void AProjectileBullet::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
|
||||
{
|
||||
ACharacter* OwnerCharacter = Cast<ACharacter>(GetOwner());
|
||||
|
|
|
@ -17,6 +17,10 @@ class BLASTER_API AProjectileBullet : public AProjectile
|
|||
public:
|
||||
|
||||
AProjectileBullet();
|
||||
|
||||
#if WITH_EDITOR
|
||||
virtual void PostEditChangeProperty(FPropertyChangedEvent& Event) override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -25,6 +25,23 @@ void AProjectileRocket::Destroyed()
|
|||
{
|
||||
}
|
||||
|
||||
#if WITH_EDITOR
|
||||
void AProjectileRocket::PostEditChangeProperty(FPropertyChangedEvent& Event)
|
||||
{
|
||||
Super::PostEditChangeProperty(Event);
|
||||
|
||||
const FName PropertyName = Event.Property != nullptr ? Event.Property->GetFName() : NAME_None;
|
||||
if (PropertyName == GET_MEMBER_NAME_CHECKED(AProjectileRocket, InitialSpeed))
|
||||
{
|
||||
if (RocketMovementComponent)
|
||||
{
|
||||
RocketMovementComponent->InitialSpeed = InitialSpeed;
|
||||
RocketMovementComponent->MaxSpeed = InitialSpeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void AProjectileRocket::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
|
|
@ -16,6 +16,11 @@ class BLASTER_API AProjectileRocket : public AProjectile
|
|||
public:
|
||||
AProjectileRocket();
|
||||
virtual void Destroyed() override;
|
||||
|
||||
#if WITH_EDITOR
|
||||
virtual void PostEditChangeProperty(FPropertyChangedEvent& Event) override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
virtual void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) override;
|
||||
|
|
Loading…
Reference in New Issue