Stash work on refactor of trajecotry

This commit is contained in:
Michal Pikulski
2025-12-04 16:23:53 +01:00
parent 6d4080438d
commit e90f839fc1
7 changed files with 644 additions and 65 deletions

View File

@@ -44,12 +44,8 @@ namespace Minigames.Airplane.Core
[Tooltip("Airplane prefab to spawn")]
[SerializeField] private GameObject airplanePrefab;
[Header("Visual Feedback")]
[Tooltip("Line renderer for trajectory preview (optional)")]
[SerializeField] private LineRenderer trajectoryLine;
[Tooltip("Visual indicator for launch anchor (optional)")]
[SerializeField] private GameObject anchorVisual;
// Note: Trajectory preview is handled by base DragLaunchController class
// It will auto-find TrajectoryPreview component on this GameObject
#endregion
@@ -81,17 +77,7 @@ namespace Minigames.Airplane.Core
}
}
// Setup trajectory line
if (trajectoryLine != null)
{
trajectoryLine.enabled = false;
}
// Hide anchor visual initially
if (anchorVisual != null)
{
anchorVisual.SetActive(false);
}
// Base class handles trajectory preview setup
}
#endregion
@@ -211,11 +197,7 @@ namespace Minigames.Airplane.Core
// Launch the airplane
_activeAirplane.Launch(direction, force);
// Hide trajectory preview
if (trajectoryLine != null)
{
trajectoryLine.enabled = false;
}
// Trajectory preview is automatically hidden by base class
if (showDebugLogs)
{

View File

@@ -112,11 +112,6 @@ namespace Minigames.FortFight.Core
#region Override Methods
protected override float GetProjectileMass()
{
return _currentAmmo?.GetMass() ?? base.GetProjectileMass();
}
protected override void StartDrag(Vector2 worldPosition)
{
// Check ammo before starting drag
@@ -129,29 +124,6 @@ namespace Minigames.FortFight.Core
base.StartDrag(worldPosition);
}
#endregion
#region Abstract Method Implementations
protected override void ShowPreview()
{
trajectoryPreview?.Show();
}
protected override void HidePreview()
{
trajectoryPreview?.Hide();
}
protected override void UpdateVisuals(Vector2 currentPosition, Vector2 direction,
float force, float dragDistance, float mass)
{
if (trajectoryPreview != null)
{
trajectoryPreview.UpdateTrajectory(launchAnchor.position, direction, force, mass);
}
}
protected override void PerformLaunch(Vector2 direction, float force)
{
LaunchProjectile(direction, force);