Rework of base interactables and managed behaviors

This commit is contained in:
Michal Pikulski
2025-11-04 11:11:27 +01:00
parent 0dc3f3e803
commit c57e3aa7e0
62 changed files with 11193 additions and 1376 deletions

View File

@@ -2,8 +2,8 @@
using Pathfinding;
using AppleHills.Core.Settings;
using Core;
using Core.Lifecycle;
using Core.SaveLoad;
using Bootstrap;
namespace Input
{
@@ -21,7 +21,7 @@ namespace Input
/// Handles player movement in response to tap and hold input events.
/// Supports both direct and pathfinding movement modes, and provides event/callbacks for arrival/cancellation.
/// </summary>
public class PlayerTouchController : MonoBehaviour, ITouchInputConsumer, ISaveParticipant
public class PlayerTouchController : ManagedBehaviour, ITouchInputConsumer, ISaveParticipant
{
// --- Movement State ---
private Vector3 targetPosition;
@@ -70,7 +70,9 @@ namespace Input
// Save system tracking
private bool hasBeenRestored;
void Awake()
public override int ManagedAwakePriority => 100; // Player controller
protected override void OnManagedAwake()
{
aiPath = GetComponent<AIPath>();
artTransform = transform.Find("CharacterArt");
@@ -87,19 +89,12 @@ namespace Input
// Initialize settings reference using GetSettingsObject
_settings = GameManager.GetSettingsObject<IPlayerFollowerSettings>();
// Register for post-boot initialization
BootCompletionService.RegisterInitAction(InitializePostBoot);
}
void Start()
{
// Set default input consumer
InputManager.Instance?.SetDefaultConsumer(this);
_logVerbosity = DeveloperSettingsProvider.Instance.GetSettings<DebugSettings>().inputLogVerbosity;
}
private void InitializePostBoot()
{
// Register with save system after boot
// Register with save system
if (SaveLoadManager.Instance != null)
{
SaveLoadManager.Instance.RegisterParticipant(this);
@@ -110,9 +105,11 @@ namespace Input
Logging.Warning("[PlayerTouchController] SaveLoadManager not available for registration");
}
}
void OnDestroy()
protected override void OnDestroy()
{
base.OnDestroy();
// Unregister from save system
if (SaveLoadManager.Instance != null)
{