File size: 820 Bytes
8d44bc8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | // Copyright Epic Games, Inc. All Rights Reserved.
#include "SideScrollingMovingPlatform.h"
#include "Components/SceneComponent.h"
ASideScrollingMovingPlatform::ASideScrollingMovingPlatform()
{
PrimaryActorTick.bCanEverTick = false;
// create the root comp
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
}
void ASideScrollingMovingPlatform::Interaction(AActor* Interactor)
{
// ignore interactions if we're already moving
if (bMoving)
{
return;
}
// raise the movement flag
bMoving = true;
// pass control to BP for the actual movement
BP_MoveToTarget();
}
void ASideScrollingMovingPlatform::ResetInteraction()
{
// ignore if this is a one-shot platform
if (bOneShot)
{
return;
}
// reset the movement flag
bMoving = false;
}
|