Changed variable animation -> animationComponent in SpineboyCppPawn.cpp (#2344)

This commit is contained in:
Misaki Eymard 2023-09-04 17:38:06 +09:00 committed by GitHub
parent 6ec9637ed6
commit d041e9e39c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,15 +14,15 @@ ASpineboyCppPawn::ASpineboyCppPawn() {
// Called when the game starts or when spawned
void ASpineboyCppPawn::BeginPlay() {
Super::BeginPlay();
USpineSkeletonAnimationComponent *animation = FindComponentByClass<USpineSkeletonAnimationComponent>();
animation->SetAnimation(0, FString("walk"), true);
USpineSkeletonAnimationComponent *animationComponent = FindComponentByClass<USpineSkeletonAnimationComponent>();
animationComponent->SetAnimation(0, FString("walk"), true);
}
// Called every frame
void ASpineboyCppPawn::Tick(float DeltaTime) {
Super::Tick(DeltaTime);
USpineSkeletonAnimationComponent *animation = FindComponentByClass<USpineSkeletonAnimationComponent>();
spine::AnimationState *state = animation->GetAnimationState();
USpineSkeletonAnimationComponent *animationComponent = FindComponentByClass<USpineSkeletonAnimationComponent>();
spine::AnimationState *state = animationComponent->GetAnimationState();
spine::TrackEntry *entry = state->getCurrent(0);
if (entry) {
GEngine->AddOnScreenDebugMessage(-1, 0.5f, FColor::Yellow, FString(entry->getAnimation()->getName().buffer()));