Pulver trash maze sequence
This commit is contained in:
@@ -42,6 +42,9 @@ public class FollowerController : ManagedBehaviour
|
||||
private IFollowerSettings _settings;
|
||||
private IInteractionSettings _interactionSettings;
|
||||
|
||||
// Follower active state
|
||||
private bool _isFollowerActive = false;
|
||||
|
||||
private GameObject _playerRef;
|
||||
private Transform _playerTransform;
|
||||
private AIPath _playerAIPath;
|
||||
@@ -133,10 +136,18 @@ public class FollowerController : ManagedBehaviour
|
||||
{
|
||||
// Find player reference when scene is ready (called for every scene load)
|
||||
FindPlayerReference();
|
||||
|
||||
// Auto-activate follower mode when scene is ready
|
||||
// This ensures Pulver automatically follows Trafalgar in any scene by default
|
||||
ActivateFollower();
|
||||
Logging.Debug("[FollowerController] Auto-activated follower mode on scene ready");
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
// Only process if follower is active
|
||||
if (!_isFollowerActive) return;
|
||||
|
||||
if (_playerTransform == null)
|
||||
{
|
||||
return;
|
||||
@@ -274,6 +285,118 @@ public class FollowerController : ManagedBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
#region Follower Lifecycle
|
||||
|
||||
/// <summary>
|
||||
/// Activate follower behavior - starts following the player.
|
||||
/// </summary>
|
||||
public void ActivateFollower()
|
||||
{
|
||||
_isFollowerActive = true;
|
||||
|
||||
// Find/refresh player reference
|
||||
FindPlayerReference();
|
||||
|
||||
// Check if a pickup is currently in progress
|
||||
bool pickupInProgress = _pickupCoroutine != null;
|
||||
|
||||
if (!pickupInProgress)
|
||||
{
|
||||
// Only reset to manual following mode if no pickup is active
|
||||
_isManualFollowing = true;
|
||||
_isReturningToPlayer = false;
|
||||
_isPlayingStationaryAnimation = false;
|
||||
_currentSpeed = 0f;
|
||||
_timer = 0f;
|
||||
|
||||
// Stop stationary animation coroutine if active
|
||||
if (_stationaryAnimationCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_stationaryAnimationCoroutine);
|
||||
_stationaryAnimationCoroutine = null;
|
||||
}
|
||||
|
||||
// Disable AIPath for manual following
|
||||
if (_aiPath != null)
|
||||
{
|
||||
_aiPath.enabled = false;
|
||||
}
|
||||
|
||||
// Initialize follow target position
|
||||
UpdateFollowTarget();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Pickup in progress - don't interfere, just mark as active
|
||||
Logging.Debug("[FollowerController] Follower activated but pickup in progress - not resetting state");
|
||||
}
|
||||
|
||||
// Always enable TrackableTarget when follower is active
|
||||
var trackableTarget = GetComponent<UI.Tracking.TrackableTarget>();
|
||||
if (trackableTarget != null)
|
||||
{
|
||||
trackableTarget.enabled = true;
|
||||
}
|
||||
|
||||
Logging.Debug("[FollowerController] Follower activated");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deactivate follower behavior - stops all following and movement.
|
||||
/// </summary>
|
||||
public void DeactivateFollower()
|
||||
{
|
||||
_isFollowerActive = false;
|
||||
|
||||
// Stop all coroutines
|
||||
if (_pickupCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_pickupCoroutine);
|
||||
_pickupCoroutine = null;
|
||||
}
|
||||
|
||||
if (_stationaryAnimationCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_stationaryAnimationCoroutine);
|
||||
_stationaryAnimationCoroutine = null;
|
||||
}
|
||||
|
||||
// Reset movement state
|
||||
_isManualFollowing = false;
|
||||
_isReturningToPlayer = false;
|
||||
_isPlayingStationaryAnimation = false;
|
||||
_currentSpeed = 0f;
|
||||
|
||||
// Disable AIPath
|
||||
if (_aiPath != null)
|
||||
{
|
||||
_aiPath.enabled = false;
|
||||
_aiPath.isStopped = true;
|
||||
}
|
||||
|
||||
// Disable TrackableTarget component if present
|
||||
var trackableTarget = GetComponent<UI.Tracking.TrackableTarget>();
|
||||
if (trackableTarget != null)
|
||||
{
|
||||
trackableTarget.enabled = false;
|
||||
}
|
||||
|
||||
// Set animator to idle
|
||||
if (_animator != null)
|
||||
{
|
||||
_animator.SetFloat("Speed", 0f);
|
||||
}
|
||||
|
||||
Logging.Debug("[FollowerController] Follower deactivated");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if follower is currently active.
|
||||
/// </summary>
|
||||
public bool IsFollowerActive => _isFollowerActive;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Movement
|
||||
/// <summary>
|
||||
/// Updates the follower's target point to follow the player at a specified distance,
|
||||
|
||||
Reference in New Issue
Block a user