63 lines
1.8 KiB
C++
63 lines
1.8 KiB
C++
// Project Lab - NHTV Igad
|
|
|
|
#include "UnrealProject.h"
|
|
#include "WiebertAnimation.h"
|
|
#include "NetworkCharacter.h"
|
|
#include "Animation/AnimNodeBase.h"
|
|
#include "AnimationProxy.h"
|
|
|
|
UWiebertAnimation::UWiebertAnimation(const FObjectInitializer& init)
|
|
: Super(init)
|
|
{
|
|
character = nullptr;
|
|
attacking = false;
|
|
charCustomization = FCharacterCustomization();
|
|
m_swingAnimationSequence = 0;
|
|
}
|
|
void UWiebertAnimation::NativeInitializeAnimation()
|
|
{
|
|
attacking = false;
|
|
Super::NativeInitializeAnimation();
|
|
character = Cast<ANetworkCharacter>(this->GetOwningActor());
|
|
if (character)
|
|
{
|
|
m_swingAnimationSequence = character->swingAnimationSequence;
|
|
}
|
|
}
|
|
void UWiebertAnimation::NativeUpdateAnimation(float DeltaSeconds)
|
|
{
|
|
if(character && character->swingAnimationSequence > m_swingAnimationSequence)
|
|
{
|
|
attacking = true;
|
|
m_swingAnimationSequence = character->swingAnimationSequence;
|
|
}
|
|
}
|
|
void UWiebertAnimation::SetCharacterCustomization(const FCharacterCustomization& characterCustomization)
|
|
{
|
|
charCustomization = characterCustomization;
|
|
}
|
|
FAnimInstanceProxy* UWiebertAnimation::CreateAnimInstanceProxy()
|
|
{
|
|
check(!m_mainAnimProxy);
|
|
m_mainAnimProxy = new FMainAnimProxy();
|
|
|
|
m_mainAnimProxy->boneNames[0] = "head";
|
|
m_mainAnimProxy->boneNames[1] = "thigh_l";
|
|
m_mainAnimProxy->boneNames[2] = "thigh_r";
|
|
m_mainAnimProxy->boneNames[3] = "upperarm_l";
|
|
m_mainAnimProxy->boneNames[4] = "upperarm_r";
|
|
m_mainAnimProxy->boneNames[5] = "spine_03";
|
|
m_mainAnimProxy->boneNames[6] = "root";
|
|
|
|
return m_mainAnimProxy;
|
|
}
|
|
void UWiebertAnimation::DestroyAnimInstanceProxy(FAnimInstanceProxy* InProxy)
|
|
{
|
|
check(InProxy == m_mainAnimProxy);
|
|
delete InProxy;
|
|
m_mainAnimProxy = nullptr;
|
|
}
|
|
void UWiebertAnimation::OnSwingAnimation_Implementation()
|
|
{
|
|
}
|