worldbox-observer-mod/IdleSpectator/CameraDirector.cs
2026-07-14 13:20:49 -05:00

41 lines
1 KiB
C#

using NeoModLoader.services;
using UnityEngine;
namespace IdleSpectator;
public static class CameraDirector
{
public static void Watch(InterestEvent interest)
{
if (interest == null || !interest.HasValidPosition)
{
return;
}
if (!Config.game_loaded || World.world == null)
{
return;
}
string tip = string.IsNullOrEmpty(interest.Label)
? "Watching event"
: "Watching: " + interest.Label;
WorldTip.showNowTop(tip, pTranslate: false);
LogService.LogInfo($"[IdleSpectator] {tip}");
if (interest.HasFollowUnit)
{
World.world.locateAndFollow(interest.FollowUnit, null, null);
return;
}
World.world.locatePosition(interest.Position);
}
public static void ClearFollow()
{
// PowerButtonSelector.instance is internal to the game assembly.
// Clearing the focus unit is enough to leave native spectator follow.
MoveCamera.clearFocusUnitOnly();
}
}