Generic MVP working
This commit is contained in:
@@ -20,27 +20,12 @@ namespace Minigames.Airplane.Core
|
||||
|
||||
#endregion
|
||||
|
||||
#region Inspector References
|
||||
|
||||
[Header("Cinemachine Cameras")]
|
||||
[Tooltip("Camera for intro sequence")]
|
||||
[SerializeField] private CinemachineCamera introCamera;
|
||||
|
||||
[Tooltip("Camera for showing the next person")]
|
||||
[SerializeField] private CinemachineCamera nextPersonCamera;
|
||||
|
||||
[Tooltip("Camera for aiming view")]
|
||||
[SerializeField] private CinemachineCamera aimingCamera;
|
||||
|
||||
[Tooltip("Camera that follows the airplane (should have CinemachineFollow)")]
|
||||
[SerializeField] private CinemachineCamera flightCamera;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Lifecycle
|
||||
|
||||
internal override void OnManagedAwake()
|
||||
{
|
||||
// Base class handles InitializeCameraMap() and ValidateCameras()
|
||||
base.OnManagedAwake();
|
||||
|
||||
// Set singleton
|
||||
@@ -51,18 +36,6 @@ namespace Minigames.Airplane.Core
|
||||
return;
|
||||
}
|
||||
_instance = this;
|
||||
|
||||
// Register cameras
|
||||
RegisterCamera(AirplaneCameraState.Intro, introCamera);
|
||||
RegisterCamera(AirplaneCameraState.NextPerson, nextPersonCamera);
|
||||
RegisterCamera(AirplaneCameraState.Aiming, aimingCamera);
|
||||
RegisterCamera(AirplaneCameraState.Flight, flightCamera);
|
||||
|
||||
// Finalize initialization
|
||||
FinalizeInitialization();
|
||||
|
||||
// Validate
|
||||
ValidateCameras();
|
||||
}
|
||||
|
||||
internal override void OnManagedDestroy()
|
||||
@@ -81,28 +54,13 @@ namespace Minigames.Airplane.Core
|
||||
|
||||
protected override void ValidateCameras()
|
||||
{
|
||||
if (introCamera == null)
|
||||
{
|
||||
Logging.Error("[AirplaneCameraManager] Intro camera not assigned!");
|
||||
}
|
||||
// Base class validates all enum states have cameras assigned
|
||||
base.ValidateCameras();
|
||||
|
||||
if (nextPersonCamera == null)
|
||||
// Additional validation: Check if flight camera has follow component
|
||||
var flightCamera = GetCamera(AirplaneCameraState.Flight);
|
||||
if (flightCamera != null)
|
||||
{
|
||||
Logging.Error("[AirplaneCameraManager] Next person camera not assigned!");
|
||||
}
|
||||
|
||||
if (aimingCamera == null)
|
||||
{
|
||||
Logging.Error("[AirplaneCameraManager] Aiming camera not assigned!");
|
||||
}
|
||||
|
||||
if (flightCamera == null)
|
||||
{
|
||||
Logging.Error("[AirplaneCameraManager] Flight camera not assigned!");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Verify flight camera has follow component
|
||||
var followComponent = flightCamera.GetComponent<CinemachineFollow>();
|
||||
if (followComponent == null)
|
||||
{
|
||||
@@ -120,6 +78,7 @@ namespace Minigames.Airplane.Core
|
||||
/// </summary>
|
||||
public void StartFollowingAirplane(Transform airplaneTransform)
|
||||
{
|
||||
var flightCamera = GetCamera(AirplaneCameraState.Flight);
|
||||
if (flightCamera == null)
|
||||
{
|
||||
Logging.Warning("[AirplaneCameraManager] Cannot follow airplane - flight camera not assigned!");
|
||||
@@ -146,6 +105,7 @@ namespace Minigames.Airplane.Core
|
||||
/// </summary>
|
||||
public void StopFollowingAirplane()
|
||||
{
|
||||
var flightCamera = GetCamera(AirplaneCameraState.Flight);
|
||||
if (flightCamera == null) return;
|
||||
|
||||
// Clear the follow target
|
||||
|
||||
Reference in New Issue
Block a user