35 lines
898 B
C++
35 lines
898 B
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "BlasterAnimInstance.h"
|
|
|
|
#include "BlasterCharacter.h"
|
|
#include "GameFramework/CharacterMovementComponent.h"
|
|
|
|
void UBlasterAnimInstance::NativeInitializeAnimation()
|
|
{
|
|
Super::NativeInitializeAnimation();
|
|
|
|
BlasterCharacter = Cast<ABlasterCharacter>(TryGetPawnOwner());
|
|
}
|
|
|
|
void UBlasterAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
|
|
{
|
|
Super::NativeUpdateAnimation(DeltaSeconds);
|
|
|
|
if (BlasterCharacter == nullptr)
|
|
{
|
|
BlasterCharacter = Cast<ABlasterCharacter>(TryGetPawnOwner());
|
|
}
|
|
|
|
if (BlasterCharacter == nullptr) return;
|
|
|
|
FVector Velocity = BlasterCharacter->GetVelocity();
|
|
Velocity.Z = 0.f;
|
|
Speed = Velocity.Size();
|
|
|
|
bIsInAir = BlasterCharacter->GetCharacterMovement()->IsFalling();
|
|
bIsAccelerating = BlasterCharacter->GetCharacterMovement()->GetCurrentAcceleration().Size() > 0.f;
|
|
|
|
}
|