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;
|
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)
|
void AProjectileBullet::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
|
||||||
{
|
{
|
||||||
ACharacter* OwnerCharacter = Cast<ACharacter>(GetOwner());
|
ACharacter* OwnerCharacter = Cast<ACharacter>(GetOwner());
|
||||||
|
|
|
@ -18,6 +18,10 @@ public:
|
||||||
|
|
||||||
AProjectileBullet();
|
AProjectileBullet();
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
virtual void PostEditChangeProperty(FPropertyChangedEvent& Event) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) override;
|
virtual void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) override;
|
||||||
|
|
|
@ -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()
|
void AProjectileRocket::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
|
|
@ -16,6 +16,11 @@ class BLASTER_API AProjectileRocket : public AProjectile
|
||||||
public:
|
public:
|
||||||
AProjectileRocket();
|
AProjectileRocket();
|
||||||
virtual void Destroyed() override;
|
virtual void Destroyed() override;
|
||||||
|
|
||||||
|
#if WITH_EDITOR
|
||||||
|
virtual void PostEditChangeProperty(FPropertyChangedEvent& Event) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) override;
|
virtual void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit) override;
|
||||||
|
|
Loading…
Reference in New Issue