Tangible creation and destruction in place

This commit is contained in:
2023-09-28 14:32:48 -04:00
parent 9116a7b8fe
commit 642b444d13
7 changed files with 174 additions and 32 deletions

View File

@@ -6,8 +6,12 @@
UlxTangible::UlxTangible()
{
Manager = nullptr;
TangibleId = -1;
CurrentActor = nullptr;
ActorBlueprint = nullptr;
NearAccordingToLuprex = false;
NearAccordingToUnreal = false;
}
void UlxTangible::Init(UlxTangibleManager* tm, int64 id)
@@ -69,15 +73,50 @@ void UlxTangible::SetActorBlueprintClass(TSubclassOf<AActor> bp) {
}
}
void UlxTangible::UpdateAnimationQueue(std::string_view aq) {
AnimTracker.Update(aq);
TArray<uint64> aborted = AnimTracker.GetAborted();
for (uint64 hash : aborted) {
IlxTangibleInterface::Execute_AbortAnimation(GetActor(), hash);
}
FlxAnimationStep step;
ElxAnimationMode mode = AnimTracker.GetNextStep(step);
if (mode != ElxAnimationMode::INVALID) {
bool started = IlxTangibleInterface::Execute_StartAnimation(GetActor(), mode, step);
if (started) {
AnimTracker.StartedStep(step.Hash);
}
}
}
FVector UlxTangible::GetLocation() const {
if (CurrentActor == nullptr) {
return FVector(0,0,0);
} else {
return CurrentActor->GetActorLocation();
}
}
void UlxTangible::Destroy() {
SetActorBlueprintClass(nullptr);
Manager = nullptr;
TangibleId = -1;
CurrentActor = nullptr;
ActorBlueprint = nullptr;
AnimTracker.Clear();
NearAccordingToLuprex = false;
NearAccordingToUnreal = false;
}
FString UlxTangible::GetTangiblePlane(AActor* actor) {
UlxTangibleComponent* comp = actor->GetComponentByClass<UlxTangibleComponent>();
check(comp != nullptr);
return comp->Tangible->Plane;
return comp->Tangible->Plane.ToString();
}
void UlxTangible::SetTangiblePlane(AActor* actor, const FString& plane) {
UlxTangibleComponent* comp = actor->GetComponentByClass<UlxTangibleComponent>();
check(comp != nullptr);
comp->Tangible->Plane = plane;
comp->Tangible->Plane = FName(plane);
}