#include "ComputePointActor.h" #include "Components/StaticMeshComponent.h" AComputePointActor::AComputePointActor() { PrimaryActorTick.bCanEverTick = false; SphereMesh = CreateDefaultSubobject(TEXT("SphereMesh")); RootComponent = SphereMesh; // Enable mouse-over events so the PlayerController can detect hover SphereMesh->bReceivesDecals = false; } void AComputePointActor::BeginPlay() { Super::BeginPlay(); SetActorScale3D(FVector(PointScale)); ApplyMaterial(); } void AComputePointActor::SetPointData(const FComputePoint& Data) { PointData = Data; // Optional: name the actor in the Outliner for easy debugging SetActorLabel(FString::Printf(TEXT("[%d] %s"), Data.Rank, *Data.Name)); } void AComputePointActor::SetVisualState(EPointVisualState NewState) { if (VisualState == NewState) return; VisualState = NewState; ApplyMaterial(); } void AComputePointActor::ApplyMaterial() { if (!SphereMesh) return; UMaterialInterface* Mat = nullptr; switch (VisualState) { case EPointVisualState::Hovered: Mat = HoveredMaterial; break; case EPointVisualState::Selected: Mat = SelectedMaterial; break; default: Mat = NormalMaterial; break; } if (Mat) { SphereMesh->SetMaterial(0, Mat); } }