diff --git a/Content/Blueprints/Weapon/Projectiles/BP_ProjectileBullet.uasset b/Content/Blueprints/Weapon/Projectiles/BP_ProjectileBullet.uasset index 7fe9613..17dcd5f 100644 Binary files a/Content/Blueprints/Weapon/Projectiles/BP_ProjectileBullet.uasset and b/Content/Blueprints/Weapon/Projectiles/BP_ProjectileBullet.uasset differ diff --git a/Content/Blueprints/Weapon/Projectiles/BP_Rocket.uasset b/Content/Blueprints/Weapon/Projectiles/BP_Rocket.uasset index 9046115..c8f2b0e 100644 Binary files a/Content/Blueprints/Weapon/Projectiles/BP_Rocket.uasset and b/Content/Blueprints/Weapon/Projectiles/BP_Rocket.uasset differ diff --git a/Source/Blaster/Weapon/ProjectileBullet.cpp b/Source/Blaster/Weapon/ProjectileBullet.cpp index 9dfd523..4b3bf2e 100644 --- a/Source/Blaster/Weapon/ProjectileBullet.cpp +++ b/Source/Blaster/Weapon/ProjectileBullet.cpp @@ -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(GetOwner()); diff --git a/Source/Blaster/Weapon/ProjectileBullet.h b/Source/Blaster/Weapon/ProjectileBullet.h index ca15f10..a53a101 100644 --- a/Source/Blaster/Weapon/ProjectileBullet.h +++ b/Source/Blaster/Weapon/ProjectileBullet.h @@ -17,6 +17,10 @@ class BLASTER_API AProjectileBullet : public AProjectile public: AProjectileBullet(); + +#if WITH_EDITOR + virtual void PostEditChangeProperty(FPropertyChangedEvent& Event) override; +#endif protected: diff --git a/Source/Blaster/Weapon/ProjectileRocket.cpp b/Source/Blaster/Weapon/ProjectileRocket.cpp index 61c28a2..8eb91c1 100644 --- a/Source/Blaster/Weapon/ProjectileRocket.cpp +++ b/Source/Blaster/Weapon/ProjectileRocket.cpp @@ -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(); diff --git a/Source/Blaster/Weapon/ProjectileRocket.h b/Source/Blaster/Weapon/ProjectileRocket.h index 3b9010f..a0c2e10 100644 --- a/Source/Blaster/Weapon/ProjectileRocket.h +++ b/Source/Blaster/Weapon/ProjectileRocket.h @@ -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;